创建一个具有超级用户权利的用户
GRANT ALL ON *.* TO anyname@localhost IDENTIFIED BY "passwd" WITH GRANT OPTION;
数据库级权限用一个ON db_name.*子句而不是ON *.*进行授权:
GRANT ALL ON xy_db_activity TO boris@localhost IDENTIFIED BY "boris";
如果你为一个数据库授权,如果需要在mysql.db表中创建一个条目。
GRANT ALL ON xy_db_config TO kite@localhost IDENTIFIED BY "ruby";
当所有为数据库的授权用REVOKE删除时,这个条目被删除。
REVOKE ALL ON xy_db_config FROM kite@localhost;
授权java用户192.168.1.99ip所有权限
mysql> select * from user;mysql> GRANT ALL ON *.* TO java@'192.168.1.99' IDENTIFIED BY "java" WITH GRANT OPTION;GRANT ALL ON *.* TO java@'192.168.1.31' IDENTIFIED BY "java" ;SHOW GRANTS;FLUSH PRIVILEGES;
查看用户授权信息
SHOW GRANTS FOR java@'192.168.1.32';
mysql> grant all on *.* to root@'%' identified by "123456";Query OK, 0 rows affected (0.00 sec)
淘宝小店-运维学习参考资料