授权时报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

时间:2022-09-12 19:21:26

一:问题描述

mysql> grant select on *.* to 'jiao';

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

二:出错原因

该用户没有授权权限

三:解决办法

mysql> update mysql.user set Grant_Priv='Y' where user='root' and host='localhost';

mysql> flush privileges;
Query OK, 0 rows affected (0.07 sec)

或者通过grant ... with grant option;


退出后重新登录,再次授权即可

grant select on *.* to 'jiao';