Access denied for user '用户'
解释:拒绝用户访问
1.登录mysql,use mysql使用mysql数据库
2.select host, user from user;//查询可用用户以及该用户可操作的ip地址
3.授权该用户可以在所有ip地址登录GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
4.刷新flush privileges;
然后改了后立马报另一个错:
Error Code: 1142 SELECT command denied to user 'hb'@'localhost' for table 'userinfo'
能登录但其他啥也干不了
SELECT alter_priv FROM user WHERE User = 'hb';
alter_priv
N
N说明hb用户没有ALTER权限
UPDATE user SET alter_priv='Y' WHERE User = 'hb';
刷新flush privileges;
总之就是权限问题,赋予用户all权限应该就没问题。