phpMyAdmin Access denied for user ‘root’@’localhost’

遇到这种报错,先检查MySQL版本,如果是5.7的话,那默认是不允许phpmyadmin使用root登录的。
解决办法是,建立一个phpmyadmin专用账户,流程如下:

1.进入mysql命令行

sudo mysql --user=root mysql

2.创建phpmyadmin用户

CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY '你的密码';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

3.用刚才创建的用户登录即可

方法来自:https://askubuntu.com/questions/763336/cannot-enter-phpmyadmin-as-root-mysql-5-7


未经允许不得转载:阿藏博客 » phpMyAdmin Access denied for user ‘root’@’localhost’