to grant access to the USER;
grant all privileges on *.* to 'user'@'%';
'%' - here is indicating, the 'user' are able to connect via any host
to create a mysql user,
CREATE USER 'user'@'%' IDENTIFIED BY 'pswd123';
SAMPLE: To create User with "Select" access only
Case 1: to create a user "report" that can access the dabatase from any IPRange
> CREATE USER 'report'@'%' IDENTIFIED BY 'p@ssw0rd';
> GRANT select ON *.* to 'report'@'%';
Case 2: to create a user "report" that can access the dabatase from localhost only
> CREATE USER 'report'@'localhost' IDENTIFIED BY 'p@ssw0rd';
> GRANT select ON *.* to 'report'@'localhost';
NOTE: after create the user, don't forget to flush the privileges.
> FLUSH PRIVILEGES;
No comments:
Post a Comment