ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

created at 12-30-2021 views: 8


When connecting to MySql database remotely

ERROR 1045 (28000): Access denied for user'root'@'localhost' (using password: YES)


step1 Go inside the container

Docker exec -it [mysql container name] /bin/bash

step2 Log in to mysql

Mysql -uroot -p 
password:[Enter your password] or press enter directly

step3 Execute the following command

use MySQL;

step4 authorization

Grant all privileges on *.* to ‘root’@'%' identified by ‘yourPassword’;

step5 refresh

Flush privileges;
created at:12-30-2021
edited at: 12-30-2021: