Report this

What is the reason for this report?

how can connect mysql database in my vps?

Posted on April 9, 2015

I have installed mysql database on my vps ip, and input the following command when to login mysql.

mysql> GRANT ALL PRIVILEGES ON . TO ‘root’@'%'IDENTIFIED BY ‘passwd’ WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; service mysql restart

Now i want to login mysql database on my vps ip from remote machine.

mysql -h vps_ip -P 3306 -u root -ppasswd ERROR 2003 (HY000): Can’t connect to MySQL server on ‘vps_ip’ (111)

Why can’t login ?



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!

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.

It’s great. I spent a long time not solving this problem. Thank you!

Thanks for the simple instructions. Saved a lot of time for me. Most of the search on this topic is leading to Remote user connections.

It is ok for me .

sed -i.bak “s/127.0.0.1/Your_Droplet’s_IP/g” /etc/mysql/my.cnf; service mysql restart;

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.