Mysql grant権限管理
14857 ワード
MySQL :
grant on to [identified by ' ']
, , slave , all
192.168.0.2 , funsion ( / )
grant all on *.* to slave@192.168.0.2 identified by 'funsion';
, FLUSH PRIVILEGES;
、grant , 、 、 、 。
grant select, insert, update, delete on testdb.* to common_user@'%'
、grant , 、 、 、 、 ..... 。
grant create, alter, drop on testdb.* to developer@'192.168.0.%';
grant MySQL 。
grant references on testdb.* to developer@'192.168.0.%';
grant MySQL 。
grant index on testdb.* to developer@'192.168.0.%';
IP :
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
grant MySQL 。
grant create temporary tables on testdb.* to developer@'192.168.0.%';
grant MySQL 、 。
grant create view on testdb.* to developer@'192.168.0.%';
grant show view on testdb.* to developer@'192.168.0.%';
grant MySQL 、 。
grant create routine on testdb.* to developer@'192.168.0.%'; -- now, can show procedure status
grant alter routine on testdb.* to developer@'192.168.0.%'; -- now, you can drop a procedure
grant execute on testdb.* to developer@'192.168.0.%';
, FLUSH PRIVILEGES;
、grant DBA MySQL 。
grant all privileges on testdb to dba@'localhost'
, privileges 。
、grant DBA MySQL 。
grant all on *.* to dba@'localhost'
、MySQL grant , 。
1. grant MySQL :
grant select on *.* to dba@localhost; -- dba MySQL 。
grant all on *.* to dba@localhost; -- dba MySQL
2. grant :
grant select on testdb.* to dba@localhost; -- dba testdb 。
3. grant :
grant select, insert, update, delete on testdb.orders to dba@localhost;
、 MySQL
( ) :
show grants;
MySQL :
show grants for dba@localhost;
、 MySQL 。
revoke grant , to from :
grant all on *.* to dba@localhost;
revoke all on *.* from dba@localhost;
# ************************************* ************************************** #
SELECT command denied to user ' '@' ' for table ' ' , , 。
SELECT command denied to user 'my'@'%' for table 'proc', , , 、 , mysql proc
mysql 5 :user、db、host、tables_priv columns_priv。
:
[user ]
user , ( ) 。 user , 。 , DELETE , , 。
[db ]
db , 。 。
[host ]
host db , db 。 GRANT REVOKE , , 。
[tables_priv ]
tables_priv , 。
[columns_priv ]
columns_priv 。 。