mysqldebianraspbian

Error: Can't connect to MySQL Server (110)


I have a home-hosted MySQL Server which for some reason is giving me this:

Connection failed: Can't connect to MySQL server on '9x.x.xxx.xx4' (111)

I've portforwarded 3306, and when looking for solutions, for example, putting a hashtag before "bind-address", it would not connect me at all. Another example is changing the "bind-address" value to my public IP, but that gave me the same error. I can connect on phpMyAdmin, but not on an external IP or a php file.

Is there anything else I can try?

EDIT: I'm now getting this:

Connection failed: Can't connect to MySQL server on '9x.x.xxx.xx4' (110)

Is this something different, or the same?


Solution

  • Edit: I really frown at my younger-self.

    What would've been ideal is to actually put bind-address: 0.0.0.0, to have the MySQL server listen on all interfaces. But, I was 13 or 14, so ¯\_(ツ)_/¯


    Okay, I figured it out. In the my.cnf file it had this line:

    bind-address: 127.0.0.1

    I typed ifconfig into the Linux command prompt which gave me my local IP details. All I had to do is change it to that IP. Example:

    bind-address: 192.168.0.X

    Thank you to everyone to tried to help me out!