I want to have a MySQL user that will only able to create a new user+database(+password) combinations - without being the mysql root user for obvious security concerns.

My idea is to have a secure user (INSERT privileges only) that will modify the mysql table directly, but I don't know if there are consequences.

To be clear, I want to create a user that will only be able to generate users+database+password combinations using an automated script that will run using that user. I want that user to operate on the least permissions as possible.

What are my other options?

link|improve this question

60% accept rate
might help: serverfault.com/questions/128740/… – Kalmi May 19 '10 at 16:08
feedback

migrated from stackoverflow.com Oct 9 '09 at 6:42

This question came from our site for professional and enthusiast programmers.

1 Answer

You can do it using the normal GRANT system in MySQL. But the user you're using will need all the same access they're trying to GRANT. You can only do GRANTs with the same permissions or less than your current user.

Don't start messing around with the system tables, it's not necessary.

link|improve this answer
I just created a user with only the GRANT privilege. I cannot create new database. – LiraNuna Oct 9 '09 at 6:24
You need more than just the GRANT privilege. You will need to give the user other privileges as well. Refer to the MySQL docs for a list of privileges to grant. – sybreon Oct 9 '09 at 7:11
feedback

Your Answer

 
or
required, but never shown

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