Skip to content

Commit

Permalink
mysql: add read only user instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsiryk committed Mar 16, 2020
1 parent 630c83f commit c1d659c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion mysql.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,19 @@ Create user and add privileges::
GRANT ALL PRIVILEGES ON db_name.* TO 'newuser'@'localhost'; # db.table
FLUSH PRIVILEGES;

SHOW GRANTS FOR 'root'@'localhost';

# Allow only select requests. % - means from everywhere
GRANT SELECT ON *.* TO 'username'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

# Allow see everything but not change (inluding system info)
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO 'username'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
# "Reading" the definition of views is the SHOW VIEW privilege.
# "Reading" the list of currently-executing queries by other users is the PROCESS privilege.
# "Reading" the current replication state is the REPLICATION CLIENT privilege.

SHOW GRANTS FOR 'username'@'%';


Delete mysql user::
Expand Down

0 comments on commit c1d659c

Please sign in to comment.