Mysql create a read-only account

mysql create a read-only account;

1, all account information inquiry

SELECT DISTINCT a.`User`,a.`Host`,a.password_expired,a.password_last_changed,a.password_lifetime,a.* FROM mysql.user a;

Example:

1 , create an account and authorize SELECT query permitted. 

.> GRANT ON dbname the SELECT * the TO ' username ' @ ' % ' IDENTIFIED BY " password " ; 

2 . Refresh mysql privileges, allowing users to create, authorize force.

> FLUSH PRIVILEGES;

2, permission to add views:

> UPDATE mysql.`user` a SET a.Show_view_priv='Y' WHERE a.`User`='username' and a.`Host`='IP';
> FLUSH PRIVILEGES;

 

Guess you like

Origin www.cnblogs.com/sharesdk/p/11305172.html