mysql在console / phpmyadmin上显示错误:ERROR 1044(42000):用户'root'@'localhost'访问被拒绝到数据库'test123'

时间:2015-08-21 05:56:03

标签: mysql phpmyadmin ubuntu-14.04

无法从phpmyadmin或mysql命令行创建,删除数据库。它显示错误:

  "ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'test123'"

谷歌搜索后,我发现要使用命令向用户授予权限:

  GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';
  FLUSH PRIVILEGES;

但它也给出了上面提到的错误。

我还在系统中再次卸载并安装mysql和phpmyadmin,但仍然出现相同的错误。

请建议。

mysql> show grants;

 +--------------+
 | Grants for root@localhost                                                         |
 +------------------------------------+
 | GRANT USAGE ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD    <secret>      |
 | GRANT ALL PRIVILEGES ON `oe_school`.* TO 'root'@'localhost' WITH GRANT OPTION |

+ ---------------------------------------------- - +

1 个答案:

答案 0 :(得分:0)

最后我解决了它卸载MYSQL并删除Mysql文件夹的问题。

 sudo apt-get remove --purge mysql-server mysql-client mysql-common
 sudo apt-get autoremove
 sudo apt-get autoclean
 sudo rm -rf /var/lib/mysql