CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT privilege ON database.table TO 'username'@'%';
The above can be combined into one as;
GRANT privilege ON database.table TO 'username'@'%' IDENTIFIED BY 'password';
To grant basic permissions on a specific database or table. for example;
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT EXECUTE ON database.* TO 'username'@'%';
which would allow the username to run procedures in the specified database and nothing else.
The following may also be of use;
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password';
GRANT GRANT OPTION ON *.* TO 'username'@'%';
Example:
GRANT SELECT ON fcc.* TO 'engineer'@'localhost';
GRANT SELECT ON mccarc.* TO 'engineer'@'localhost';
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'engineer'@'localhost';
No comments:
Post a Comment
Note: only a member of this blog may post a comment.