简体   繁体   中英

Mysql showing error on console/phpmyadmin : ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'test123'

Not able to create,drop database from phpmyadmin or mysql command line. It showing error:

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

After googling i found that to grant the permission to user using the command:

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

But it also giving the error as mentioned above.

I have also uninstall and install the mysql and phpmyadmin again in the system but still getting same error's.

Please advice.

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 |

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

Finally i solved issue it to uninstall MYSQL and also delete the Mysql folder.

 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM