MySQL Forums
Forum List  »  Newbie

mysql granting access for same user from different hosts
Posted by: Ravi Malghan
Date: July 13, 2018 06:30PM

I have 3 client servers (host1, host2, host3) connecting to a MySQL database. All clients use the same username/passwd. Two of them will need all privileges. 3rd one needs only select privileges. Will I need to create 3 user accounts: user@host1, user@host2, user@host3, and 3 grant statements like the following. I donot want the user to be able to login from any others other than these hosts?

CREATE USER 'test'@'host1' IDENTIFIED BY 'ABC';
GRANT ALL PRIVILEGES ON *.* TO 'test'@'host1';
CREATE USER 'test'@'host2' IDENTIFIED BY 'ABC';
GRANT ALL PRIVILEGES ON *.* TO 'test'@'host2';
CREATE USER 'test'@'host3' IDENTIFIED BY 'ABC';
GRANT SELECT ON *.* TO 'test'@'host3';

or is there a way to create one account and 3 grants?

Options: ReplyQuote


Subject
Written By
Posted
mysql granting access for same user from different hosts
July 13, 2018 06:30PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.