Posts: 1
Joined: Tue Jan 08, 2019 9:52 am

Raspberry Pi MySQL Remote Connection (error: 10061)

Thu Jan 10, 2019 10:22 am

I'm trying to connect to a MySQL server running on my Raspberry Pi 3 remotely (though on the same LAN).

Attempting to do so through HeidiSQL returns an error coded 10061. A bit of research suggests I have to edit the config to allow remote connections.

The config, however, does not contain a bind-adress x.x.x.x line (/etc/mysql/my.cnf) for my to comment out. Added it myself breaks the service, causing errors when trying to restart it. Checking other possible config file locations resulted in only empty files. kodi Additionally, comparing to the "default" config file, mine is a lot shorter, and has no actual statements, other than a few includes for other config files (it seems). These included files are all empty as well.

I'm now lost, and cannot figure out how to allow remote connections to my server. Any help is much appreciated :)
Last edited by Jason145 on Fri Jan 11, 2019 6:22 am, edited 1 time in total.

Posts: 795
Joined: Sat Jun 16, 2018 12:49 am

Re: Raspberry Pi MySQL Remote Connection (error: 10061)

Thu Jan 10, 2019 6:43 pm

Can you let us know:

1) Operating system version
2) How you installed SQL
3) If SQL works locally from the command line
4) Content of your config file
Need Pi spray - these things are breeding in my house...

Posts: 249
Joined: Sat Oct 14, 2017 9:57 pm

Re: Raspberry Pi MySQL Remote Connection (error: 10061)

Sun Jan 13, 2019 3:14 pm


Step 1: check if mysql server is listening. You can use "netstat" for that. If not, you need to modify the config file (could listen on local unix sockets). It is extremely helpful to check the log files, I usually do "tail -f /var/log/mysqld/mysql.log" in another terminal. Try to connect to the server locally through loopback interface (with ip using mysql-client.

Step 2: when you are positive that mysql server is ok, then check the network connections. Can you access the port remotely from the client machine? I usually do "telnet 192.168.x.y 3306" for that. You won't be able to use it in any meaningful way, but you will see if the tcp connection builds up. Using mysql-client is equally good. If there's an error, you should look into the firewall (on both the client machine and on the sql server) or the LAN router's configuration. Again, tail-ing log files are extremely helpful (/var/log/messages, /var/log/syslog etc.).

Step 3: as a last step, use your preferred mysql library to connect to the remote mysql from your application. If there's a problem with that, but the two steps above worked, then it must be a configuration error, usually a typo in the mysql connection string or a mis-spelled password etc.

If you're unable to solve the issue with these instructions, then I also suggest to post what Andyroo asked for. That could help a lot.


Return to “Other programming languages”