patternsqlMinor
MySQL: creating a user that can connect from multiple hosts
Viewed 0 times
canconnecthostscreatingusermysqlthatmultiplefrom
Problem
I'm using MySQL and I need to create an account that can connect from either the localhost or from another server, i.e. 10.1.1.1. So I am doing:
This works fine, but is there any more elegant way to create a user account that is linked to multiple IPs or does it need to be done this way?
My main worry is that in the future, permissions will be updated form 'bob' account and not the other.
CREATE USER 'bob'@'localhost' IDENTIFIED BY 'password123';
CREATE USER 'bob'@'10.1.1.1' IDENTIFIED BY 'password123';
GRANT SELECT, INSERT, UPDATE, DELETE on MyDatabse.* to 'bob'@'localhost', 'bob'@'10.1.1.1';This works fine, but is there any more elegant way to create a user account that is linked to multiple IPs or does it need to be done this way?
My main worry is that in the future, permissions will be updated form 'bob' account and not the other.
Solution
Use this query to creating user account that can be connect from the localhost or from another server
CREATE USER 'bob'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;Code Snippets
CREATE USER 'bob'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;Context
StackExchange Database Administrators Q#200050, answer score: 2
Revisions (0)
No revisions yet.