mysql -uroot -p
即使密码正确也是连接失败的,因此你可能需要以下操作...
use mysql;
select user, plugin from mysql.user;
select @@validate_password_length;
set global validate_password_length=6;
update mysql.user set authentication_string=PASSWORD(‘123456‘), plugin=‘mysql_native_password‘ where user=‘root‘;
select @@validate_password_length;
select user, plugin from mysql.user;
flush privileges;
重启一下数据库服务:
sudo systemctl restart mysql
原文:https://blog.51cto.com/xvjunjie/2366021