Question

Remote Mysql fail to connect - Tried everything I can think of.

So I am going to walk you through everything I have done since I created this. Since this is a test before I run it for production.

ssh in, change root password adduser (new user added) usermod -aG sudo (new user) ufw limit ssh/tcp ufw limit (new ssh ip/tcp) ufw allow 3306 edit /etc/ssh/sshd_config (change ssh port and disallow root login) systemctl restart ssh (disconnect and reconnect via port 22 to make sure ssh isn’t listening. Try new port and make sure root doesn’t allow login.) Sign in via new credentials. ufw enable ufw status (verify 3306 is open) apt update apt upgrade apt install mysql-server mysql (create database) mysql (create user -> create user “user”@“%” identified by “password”; ) mysql (grant all on database.* to “user”@“%”;) mysql flush privileges; edit /etc/mysql/mysql.conf.d/mysqld.cnf set bind-address to database server ip (save & exit) systemctl restart mysql netstat -ln | grep 3306 (verify mysql is listening) attempt to connect using https://www.rainbowspuppiessunshine.com/tools/dbtest/index.php connection tool.

I get an error (111 failed to connect)

I have also tried securing the connection via a few guides and still no luck. I tried an alternate connection tool and it said refused to connect.

so I disabled the firewall (since this is just a test server)

ufw disable ufw status (verified it was disabled) tried the connection again, still nothing. refused to connect and failed to connect

there is no cloud firewall unless it’s allocated by digital ocean.

I have tried this various times and on various droplets. If I use the mysql one clicks I can’t even change the bind address without getting a fail error when mysql reloads.

I am out of ideas here. Any help or ideas would be appreciated.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

I was unable to resolve this issue. Removing the droplet and closing ticket. Anyone that is curious all steeps I have taken are listed above. It is replicate-able by simply following those steeps.

Hello,

Have you tried changing the MySQL bind-address to 0.0.0.0? Note you need to restart MySQL after the changes in your my.cnf.

Here is the netstat info https://www.dropbox.com/s/ngmmqmkyobbtyl9/putty_2019-06-11_08-29-06.png?dl=0

(currently I have the bind-address commented out.)

https://www.dropbox.com/s/a5tjgqz20vzxhd5/putty_2019-06-11_08-31-01.png?dl=0

Looks like it’s a security error. Currently I am not using any certs but I didn’t tell it to require them either. I will will secure it and try to connect again then check the log and post results here.

Yeah, sorry I tried setting it to 0.0.0.0 and just commenting the bind-address out (as per documentation that will make it listen on all ports of all connections) Still same issue.