Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a read-only user with access to one database in PHPMyAdmin. Since I'm a server newbie I followed some instructions line-by-line on setting up my database and PHPMyAdmin. As such, my root account is not accessible via the GUI; only a full access child account. This account cannot create users via the GUI, so I did the following via command line:

mysql -u root -p
mysql> create user 'readonly-user'@'localhost' IDENTIFIED BY 'password';
mysql> grant select on mydatabase.* to 'readonly-user'@'localhost';

If I try to log in via PHPMyAdmin as readonly-user, however, I'm not able to get in.

Is there something I need to do to register this account with PHPMyAdmin?

share|improve this question
I copied-and-pasted your MySQL commands to create 'readonly-user'@'localhost' and once that was done I was able to log in to phpMyAdmin as that user without difficulty. What error message(s), if any, do you get when you try to log in? – Gord Thompson Mar 17 '13 at 13:10
anyone solved this problem? – shiladitya Jun 2 '14 at 6:39
up vote 1 down vote accepted

You have to run the FLUSH PRIVILEGES; command.

share|improve this answer
Are there any special variants? I ran the command and then tried to log into PHPMyAdmin as readonly-user. I'm still getting "#1045 Cannot log in to the MySQL server" – Anthony Mar 16 '13 at 20:20
I've tried to recreate the issue on my server and so far have not been successful. After creating 'readonly-user'@'localhost' I was able to log in to phpMyAdmin as that user immediately; no FLUSH PRIVILEGES; was required. – Gord Thompson Mar 17 '13 at 13:13
@GordThompson Ok, thanks for trying. I have a few leads I'm investigating, so I'll post an answer if I find out what it is. – Anthony Mar 18 '13 at 14:20
This answer is incorrect. FLUSH PRIVILEGES is only required when you manipulate the underlying grant tables directly with DML instead of using statements like CREATE USER and GRANT. – Michael - sqlbot Mar 20 '13 at 21:26
anyone solved this problem? – shiladitya Jun 2 '14 at 6:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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