mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' installed by Docker container

Docker container installed mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

 

Using the official mirror mysql:5.7

 

Just started using inside the container

mysql -pyourpasswd

mysql -uroot -pyourpasswd 

mysql -uroot -pyourpasswd -h127.0.0.1

 

I have logged in N times and I can't get up, always reporting ERROR 1045 

Finally used a complete command, but boarded

mysql -uroot -pyourpasswd -h127.0.0.1 -P 3306 -D mysql

 

then use

 

mysql -pyourpasswd

mysql -uroot -pyourpasswd 

 

can log in,

 

Outside the container, on the host, you can also log in

mysql -uroot -pyourpasswd -h container IP

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326616390&siteId=291194637