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.

Hope we're enjoying this Fine Friday afternoon and getting ready for the weekend.

I've got a quick question. 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 lets say localhost and testserver1.

share|improve this question

migrated from stackoverflow.com Jan 18 '13 at 17:21

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

1  
It is friday night here. ^_^ –  hjpotter92 Jan 18 '13 at 14:17

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
thanks for the quick reply. that's exactly what I was looking for. –  denimknight Jan 18 '13 at 14:19
    
You're welcome. –  tsabz Jan 18 '13 at 14:25

Your Answer

 
discard

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.