Grant的时候报错的解决:Access denied for

作者: 左边跟我画个龙 | 来源:发表于2019-10-21 21:01 被阅读0次

mysql> grant all on *.* to 'root'@'192.168.1.1' identified by 'password';

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

确认方式(查看是否有grant all 没有就是权限不全):

mysql>SHOW GRANTS FOR'root'@'localhost';

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

|Grants forroot@localhost                                           |

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

|GRANTALLPRIVILEGES ON*.*TO'root'@'localhost'WITHGRANTOPTION

解决方法:执行bin下的mysql_upgrade,再重新启动数据库。

(执行前,最好先备份原来的数据库)

命令如下:

/usr/bin/mysql_upgrade -uroot -p

相关文章

网友评论

    本文标题:Grant的时候报错的解决:Access denied for

    本文链接:https://www.haomeiwen.com/subject/lgkdmctx.html