Take the 2-minute tour ×
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. It's 100% free, no registration required.

I have the following code:

TO ‘user’@example.com;

I am a beginner in mySQL, I was wondering if there is a method in which I can specific the privileges for every user in this domain network without having to type the above code for each user? %wildcard?

Also is there any method such as using a table where I can manage all the privileges of said users

share|improve this question

migrated from stackoverflow.com Oct 30 '12 at 23:53

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

do you have a table with a list of all the users? –  nathan hayfield Oct 30 '12 at 22:29
If I was to do so, do I simply insert the necessary columns and named them e.g. Insert_priv? and update the values to Yes? or is it Y? –  Mr.Z Oct 30 '12 at 22:34

3 Answers 3

As documented under GRANT Syntax:

Account Names and Passwords 

[ deletia ]

You can specify wildcards in the host name. For example, user_name@'%.example.com' applies to user_name for any host in the example.com domain, and user_name@'192.168.1.%' applies to user_name for any host in the 192.168.1 class C subnet.

The simple form user_name is a synonym for user_name@'%'.

MySQL does not support wildcards in user names.

However, you can also manage account permissions by manipulating the MySQL grant tables directly (and then executing FLUSH PRIVILEGES).

share|improve this answer
Thank you for the references! –  Mr.Z Oct 30 '12 at 22:40

You could write a PHP script to grant each person access. However I would not recommend creating new MySQL accounts for each user. Your application should deal with all of the read / write permissions

share|improve this answer
is there a method without using phpmyAdmin or php script? I only want to use the commands available to me through mysql –  Mr.Z Oct 30 '12 at 22:32
Unless you already have the names stored in another table. –  Alex Richards Oct 30 '12 at 22:35

I think you can use a GUI client like SQLyog. Its very easy to assign privileges. SQLyog provides a powerful tool for adding, editing, deleting users and managing privileges on the selected databases, tables and other database objects. Note that everything managed here is stored on the server. SQLyog does not (and a client should not) verify user's details and privileges. The MySQL server does this. Every time a connection is established the server verifies that the user details are valid and every time a user executes a query the server will check that the user has sufficient privilege to execute that statement. Accordingly users already created during installation of the server or users created with other clients can be used by SQLyog and what SQLyog creates is available for other clients as well.

share|improve this answer

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.