1

I want to create read only user in MySQL without any intervention of root user.

CREATE USER ‘$user‘@’127.0.0.1′ IDENTIFIED BY ‘$password‘;

Works for me only If I am a root user. But I want it to happen from a non root user. Can this be done?

3

From the manual

To use this statement, you must have the global CREATE USER privilege or the INSERT privilege for the mysql database.

So first you must have the root account grant you access to CREATE USER. Then your account will be able to create other users.

-2

You can read the manual http://dev.mysql.com/doc/refman/5.1/en/create-user.html

First you have to create a user and then assign permission to it.

CREATE USER 'test'@'%' IDENTIFIED BY 'test';

and later execute this query to grant global SELECT privilege.

GRANT SELECT ON *.* TO 'test'@'%';

  • You've missed the key part of the question which requires the user to create another user with CREATE USER privilege, who in turn can create users with SELECT privileges – Mark Sinkinson May 12 '14 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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