#在配置文件mysqld.cnf下添加 skip-grant-tables
vim /etc/mysql/mysql.conf.d/mysqld.cnf
重启MySQL服务
sudo service mysql restart
登录MySQL
mysql -u root -p
选择管理user表的数据库
use mysql;
authentication_string 置空
update user set authentication_string=‘’ where user=‘root’;
plugin改为以前版本的密码认证方式
update user set plugin=‘mysql_native_password’ where user=‘root’;
FLUSH PRIVILEGES;
alter user ‘root’@‘localhost’ identified by ‘newpassword’;
service mysql restart
版权声明:本文为qq_39656564原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。