Loading

ubuntu mysql Access denied for user root@localhost

解决办法:

1. vim mysqld.cnf  路径:/etc/mysql/mysql.conf.d

在[mysqld]下添加skip-grant-tables

2. 重启mysql服务

service mysql restart

3.连接mysql并设置密码

   mysql -u root

mysql>flush privileges
mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "123456";

参考博客:https://blog.csdn.net/lisongjia123/article/details/57418989

posted @ 2018-10-02 15:42  秦无殇  阅读(315)  评论(0编辑  收藏  举报