I have set up mysql remote login through a tutorial here. It was working for a while. And it suddenly stops working.
bound to 0.0.0.0
root@ubuntu20:~# netstat -plant | grep 3306 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1026/mysqld tcp6 0 0 :::33060 :::* LISTEN 1026/mysqld
root@ubuntu20:~# ufw status To Action From
3306/tcp ALLOW Anywhere
I can log in locally with the remote user, dev.
mysql> SELECT User, Host FROM mysql.user; ±-----------------±----------+ | User | Host | ±-----------------±----------+ | dev | % |
When I try to remote login with the same user, I get error 1045.
What is the problem? I didn’t do anything to the server. It just stops working.
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!
FYI - I have a ubuntu 20 and ubuntu 18 droplets with the exact remote login setup. The ubuntu 18 remote login still works. Just doesn’t work on ubuntu 20 anymore.
You have to put this as root:
GRANT ALL PRIVILEGES ON . TO ‘USERNAME’@‘IP’ IDENTIFIED BY ‘PASSWORD’ with grant option; ;
where IP is the IP you want to allow access, USERNAME is the user you use to connect, and PASSWORD is the relevant password.
If you want to allow access from any IP just put % instead of your IP
and then you only have to put
FLUSH PRIVILEGES; Or restart mysql server and that’s it.
I end up using ssh tunnel + localhost login in the client app to get around the problem. Still don’t know why it stops working and how to get it working again.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
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
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.