Remote login to mysql with error 1045

  • Posted October 26, 2020
  • MySQL

I have set up mysql remote login through a tutorial here. It was working for a while. And it suddenly stops working.

bound to

root@ubuntu20:~# netstat -plant | grep 3306 tcp 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.


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.

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.

You have to put this as root:


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.

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.