mysql8错误:Access denied for user ‘root‘@‘localhost‘ (using password: YES)

1. 先修改my.cnf

skip-grant-tables

2. 重启mysql

docker restart 容器id

3. 登录mysql

docker exec -it 容器id /bin/bash

mysql -uroot

4. 修改mysql的root密码

flush privileges;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'spy123456';

5. 刷新权限

flush privileges;

你可能感兴趣的:(mysql8错误:Access denied for user ‘root‘@‘localhost‘ (using password: YES))