0

I run a docker/alpine based mysql instance for many days, today I want to log into it, but I get the following error:

bash-4.4# mysql -uroot -h 172.19.0.1 -p
Enter password: 
ERROR 1045 (28000): Access denied for user 
'root'@'172.19.0.1' (using password: YES)

I don't know it is because I used the wrong password or any other causes, what can I do?

lily
  • 185
  • 2
  • 7
  • Are you sure `root` has the authorization to login out of localhost (mysql privileges are given host by host) ? What happens if you login directly inside the container (i.e. `docker exec -it your_container_name mysql -u root -p`) ? – Zeitounator Dec 24 '19 at 17:49
  • the same "Access denied for user" – lily Dec 25 '19 at 04:55
  • 1
    Well then it looks like you don't know your password.... You need to reset it. There is an [explanation in this article](https://www.techrepublic.com/article/how-to-set-change-and-recover-a-mysql-root-password/) (out of the numerous ones on the subject). Basically you need to mount your existing db, start it with `mysqld_safe --skip-grant-tables --skip-networking`, then connect to the db, change the root password and finally restart the database normally. – Zeitounator Dec 25 '19 at 18:03

0 Answers0