mysql创建新用户时 连接报错 (解决方案把匿名用户删除)

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

步骤 创建了mysql的用户
 insert mysql.user(Host,User,Password) values('%', 'django',password('django'));
接着赋予用户权限
grant all privileges on djtest.* to 'django'@'%' identified by 'django';
更新数据
flush privileges

然后登陆报错 ERROR 1045 (28000): Access denied for user 'ljcc'@'localhost' (using password: YES)

匿名用户惹的货

查看用户信息
select user,host from mysql.user;  ← 查看用户信息 

删除匿名用户:
delete from mysql.user where user='';
FLUSH PRIVILEGES; 

mysql -udjango -pdjango
登陆成功

 

posted @ 2018-07-09 12:37  想翻身的猫  阅读(284)  评论(0编辑  收藏  举报