Report this

What is the reason for this report?

Cannot connect to MySQL database remotely

Posted on July 20, 2021

I provisioned this MySQL droplet: https://marketplace.digitalocean.com/apps/mysql

I am able to administer MySQL if I SSH via terminal, or if I go to http://my-ip-address/phpmyadmin

But I need to connect to my DB remotely. Whether I try to connect via terminal, or something like Sequel PRO, the connection fails with this error:

Host 'xxx.xxx.xxx' is not allowed to connect to this MySQL server

I followed every step of this guide (including setting bind-address to 0.0.0.0), but nothing changes and I’m still unable to connect: https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql

Any ideas?



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.

Hi @geochanto,

Have you created a new user that will only connect from the remote host? If not suggest you create a new user and try again.

You can get your local machine IP: https://whatismyipaddress.com/

CREATE USER 'sammy'@'remote_IP' IDENTIFIED BY 'password';

ALTER USER 'sammy'@'remote_IP' IDENTIFIED WITH mysql_native_password BY 'password';

GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO 'sammy'@'remote_IP' WITH GRANT OPTION;

FLUSH PRIVILEGES;

Regards, Rajkishore

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.