how to create a user on PHPMyAdmin with database-specific access/privileges only

This is quite a confusing process, I found. Even when you are quite familiar with MySQL.

I  rarely create users so this is a handy note.

First go to privilages

Then add user

then set up a user with NO global privilages

then once done,  it should say something like:

“You have added a new user.”

CREATE USER ‘newusername’@‘localhost’ IDENTIFIED BY ‘****************’;

GRANT USAGE ON * . * TO newusername@‘localhost’ IDENTIFIED BY ‘****************’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

Then we can tweak the user’s permissions for just the db that we need need by scrolling down the page to:

“Database-specific privileges”

Use the drop down to select the appropriate one next to: “

click “Go”

then on the resulting page you can add the database specific privilages to taste.

Generally I try to limit the privilages to minimum required.

Leave a Reply