Mysql – Allow access for localhost and named server

configurationMySQLSecurity

I'm trying to set up a user to allow them access from localhost and from a specific named server. Is this possible in MySQL and if it is how do I do it?

I know I can use % under the host to allow access from any server, but I'm looking to limit the access to let's say localhost and testserver1.

Best Answer

You could use this :

GRANT ALL PRIVILEGES ON *.* TO 'username'@'ip_testserver1', 'username'@'localhost' IDENTIFIED BY 'password';

Of course, feel free to replace the ALL PRIVILEGES by the rights you want to allow to your user, and the *.* with the database name & tables name.