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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following code:

TO ‘user’;

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 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

As documented under GRANT Syntax:

Account Names and Passwords 

[ deletia ]

You can specify wildcards in the host name. For example, user_name@'' applies to user_name for any host in the 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

The GRANT syntax allows you to specify multiple users in a single query. You can't do it with a wildcard, but if you already have the list you can do this:

TO 'user1', 'user2', 'user3', 'user4', 'user5', 'user6';
share|improve this answer

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

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.