patternsqlMajor
MySQL User with Host set to a Range of IP Addresses
Viewed 0 times
withuserrangemysqlhostaddressesset
Problem
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
81.10.20.1 --> 81.10.20.15
Is there a way to do this other than create 15 users, one for each individual IP address?
thanks
Mark
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
81.10.20.1 --> 81.10.20.15
Is there a way to do this other than create 15 users, one for each individual IP address?
thanks
Mark
Solution
you can use the grant assign to a netmask like:
It will give you access from 81.10.20.1 -> 81.10.20.14, just change the subnet part to fit the range you need.
You can see more info at mysql doc account names
GRANT ALL PRIVILEGES ON database.* TO 'user'@'81.10.20.1/255.255.255.240';It will give you access from 81.10.20.1 -> 81.10.20.14, just change the subnet part to fit the range you need.
You can see more info at mysql doc account names
Code Snippets
GRANT ALL PRIVILEGES ON database.* TO 'user'@'81.10.20.1/255.255.255.240';Context
StackExchange Database Administrators Q#48992, answer score: 21
Revisions (0)
No revisions yet.