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.


Submit an answer


This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
June 11, 2019

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.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.