Aidin Aidin - 1 month ago 12
MySQL Question

Can't connect to database (10061)

I have a Raspberry Pi (first model) I use as a server. I followed a tutorial and installed Apache2, MySQL, Phpmyadmin etc.

I have also set up a ddns for my home network to be able to connect to it wherever I am, and of course forwarded the necessary ports.

At first everything worked wonders.

  • I could connect to the database using phpmyadmin by navigating to
    from any network.

  • I could also use HeidiSQL to connect to the database, again from any network.

The MySQL version I had at this time was v5.5. I wanted a feature available on v5.6 but this version was not available on my RPi (ARMv61). Instead it seemed like MariaDB should do the trick. So I updated to MariaDB using the command:

sudo aptitude install mariadb-server

Now I am not able to connect through HeidiSQL anymore, Phpmyadmin still works though from any network just like previously. Trying to connect with HeidiSQL I get the output (no matter what username/password i try):

Can't connect to MySQL server on 'adress' (10061)'

mysql -V
gives output:

mysql Ver 15.1 Distrib 10.0.27-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2

My RPi info is

Linux redface 4.4.26+ #915 Thu Oct 20 17:02:14 BST 2016 armv6l GNU/Linux

The user privileges are available in the image below

enter image description here

How can I connect to the database again using HeidiSQL? Have I missed something with the user privileges?

With phpmyadmin I use the username


This particular error is not about permissions.

The code (10061) is WSAECONNREFUSED -- a Windows socket error code for Connection refused, not to be confused with "access denied."

Connection refused typically means no service is listening on the target IP address and port. MariaDB is not listening on

mysql -V only tells you the installed client version -- it doesn't tell you anything about the MariaDB server.

Access to phpMyAdmin doesn't tell you anything, either, because with it, you're not talking to the database server remotely -- you're talking to your web server remotely, and your web server is running code that talks to the database locally from within the same machine, and often uses a different mechanism of server access that is not TCP/IP.

Check the config file for a commented-out bind_address= or similar.