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
网友评论