创建用户后登陆失败的原因是存在匿名用户:
root@controller:~# mysql -h localhost -uaa -ppassword
ERROR 1045 (28000): Access denied for user 'aa'@'localhost' (using password: YES)
解决方法:
增加普通用户后,登陆root账号,执行:
mysql> use mysql
mysql> delete from user where user='';
mysql> flush privileges;
意思是删除匿名用户。
OK,搞定,enjoy!