I have a master-slave setup, Slave is not in read only mode.(we can do all writes). I have created a user.

create user 'bhuvi'@'%' identified by 'bhuvi';
grant all privileges on *.* to 'bhuvi'@'localhost';
flush privileges;

But when I try to login, its showing

[root@1user]# mysql -u bhuvi -p
Enter password:
ERROR 1045 (28000): Access denied for user 'bhuvi'@'localhost' (using password: YES)

But I can able to login with -p

mysql -u bhuvi

I don't why its happening. AndI tried to create users like `'user'@'localhost, this is working, But I don't know why the user has '%' is not working.

(Im trying access the user login on the same server where the MySQL is installed)

1 Answer 1


network mask - is part of user name in MySQL

  1. create user 'bhuvi'@'%' identified by 'bhuvi'; - You are create user with password
  2. grant all privileges on . to 'bhuvi'@'localhost'; - You create 2nd user without password

enter image description here

1st have password, but not privileges

2nd have all privileges, but not password

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.