一、配置mysql的配置文件my.cnf
vim /etc/my.cnf #在[mysqld]部分添加如下一行字符 default_authentication_plugin = mysql_native_password
二、登录mysql,重新创建root账号:
#先刷新权限 flush privileges; #创建用户 CREATE USER 'root'@'localhost' IDENTIFIED BY 'password'; #赋予权限 GRANT ALL PRIVILEGES ON * . * TO 'root'@'localhost'; #刷新权限 flush privileges; #创建用户 CREATE USER 'root'@'127.0.0.1' IDENTIFIED BY 'password'; #赋予权限 GRANT ALL PRIVILEGES ON * . * TO 'root'@'127.0.0.1'; #刷新权限 flush privileges; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; ALTER USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY '123456'; #退出mysql操作 quit;
三、重启mysql服务:
systemctl restart mysqld;
四、重新登录phpMyAdmin,发现可以登录成功了:
版权声明:
此文为本站源创文章[或由本站编辑从网络整理改编],
转载请备注出处:
[狂码一生]
https://www.sindsun.com/articles/21/112
[若此文确切存在侵权,请联系本站管理员进行删除!]
--THE END--