无法登录新创建的mysql用户

时间:2015-07-07 10:01:01

标签: mysql

我使用以下命令创建了新用户:

create user 'test_user'@'127.0.0.1' identified by 'test_password';
grant all privileges on database_name.* to 'test_user'@'127.0.0.1';
flush privileges;

但是当我尝试使用此密码登录时,我收到了拒绝访问错误。

出了什么问题?

show grants for test_user@'127.0.0.1'命令显示:

grant usage on *.* to 'test_user'@'127.0.0.1'
grant all privileges on 'database_name'.* to 'test_user'@'127.0.0.1'

这就是全部。

1 个答案:

答案 0 :(得分:0)

尝试这样的补助:

".xlf"

并在创建用户时尝试GRANT ALL PRIVILEGES ON databasename.* TO 'test_user'@'hostname' IDENTIFIED BY 'test_password'; FLUSH PRIVILEGES; 而不是localhost