在mysql中新建了数据库,也建立了账户,按理说应该可以正常用新账户登录数据库的,因为以前一直这样用都没问题,但今天不行了。
CREATE DATABASE openfire DEFAULT CHARACTER SET 'UTF8';
GRANT ALL ON openfire.* TO openfire@'%' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;
用mysql -uopenfire -p123456 openfire,报错如下:
ERROR 1045 (28000): Access denied for user 'openfire'@'localhost' (using password: YES)
解决办法:
删除mysql中user为空的记录
delete from user where user is null;
delete from user where user='';
FLUSH PRIVILEGES;
再登录即可。