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