mysql无法为用户授权

今天在mysql数据库为用户授权时,

执行

  
  
  
  
  1. grant select on *.* to 'cracker'@'%' identified by '123456' with grant option;  

提示

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

在网上找了一大堆资料,都是关于忘记root密码,如何重新修改root密码的。可是我的root没有密码,我是用空密码登录的。

最后查找原因,原来是有user为空、host为localhost 的记录,于是用其他用户远程连接删除mysql-user中的空记录,ok!

 

你可能感兴趣的:(option,localhost,password,1045,identified)