1

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?

2
  • 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? Mar 17, 2013 at 13:10
  • anyone solved this problem?
    – shiladitya
    Jun 2, 2014 at 6:39

1 Answer 1

1

You have to run the FLUSH PRIVILEGES; command.

6
  • 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, 2013 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. Mar 17, 2013 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, 2013 at 14:20
  • 1
    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. Mar 20, 2013 at 21:26
  • anyone solved this problem?
    – shiladitya
    Jun 2, 2014 at 6:39

Your Answer

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

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