How can I restore the MySQL root user’s full privileges

烈酒焚心 提交于 2019-12-04 19:03:49

First try

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

if that does not work then do the following

  1. Stop mysqld service with this ( on UNix-like systems)

    sudo mysqld stop

  2. Restart it with the --skip-grant-tables option.

  3. Connect to the mysql with just: mysql (i.e. no -p option, and username may not be required).

  4. Use the following in the mysql client:

    UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';

  5. Flush the privileges by running

    FLUSH PRIVILEGES;

  6. Remove --skip-grant-tables option. and restart mysqld

  7. Finally run

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!