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 a hosted MySQL DB that I need to give access to from my customers site. They have a fast broadband connection which can present them with a range of IP addresses from a fixed pool.

So I need to lock down the access to their MySQL user so that the Host setting is a range of addresses within a class. Not the whole class.

I realise I can use a wildcard such as 81.91.71.% but that is too generous. Their range is more like -->

Is there a way to do this other than create 15 users, one for each individual IP address? thanks Mark

share|improve this question

For IP ranges MySQL only allows you to use % as a "anything" wild card or an underscore for a single digit.

Alternatively you could setup reverse DNS to have desired IPs resolved to something like

share|improve this answer

you can use the grant assign to a netmask like:

GRANT ALL PRIVILEGES ON database.* TO 'user'@'';

It will give you access from ->, just change the subnet part to fit the range you need.

You can see more info at mysql doc account names

share|improve this answer
Hi. Thanks for offering this idea but I did take a look at the MySQL link you provided before posting and it does say that netmasks can only be used on 8, 16, 24 or 32 bits of the address. In other words, only whole classes of address. The example states that wont work. – Mark Ogier Aug 30 '13 at 15:25

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.