码迷,mamicode.com
首页 > 其他好文 > 详细

20. pt-show-grants

时间:2018-12-01 11:17:58      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:none   b16   native   show   date   for   update   mys   exist   

 


pt-show-grants -h 192.168.100.101 -P 3306 -u admin -p admin

 

 

也可以delete,revoke,flush privileges , 用的不多,一般就是看看,拷贝赋权语句。

 

-- Grants dumped by pt-show-grants
-- Dumped from server 192.168.100.101 via TCP/IP, MySQL 5.7.20-log at 2018-11-23 15:16:36
-- Grants for ‘admin‘@‘%‘
CREATE USER IF NOT EXISTS ‘admin‘@‘%‘;
ALTER USER ‘admin‘@‘%‘ IDENTIFIED WITH ‘mysql_native_password‘ AS ‘*4ACFE3202A5FF5CF467898FC58AAB1D615029441‘ REQUIRE NONE PASSWORD EXPIRE NEVER ACCOUNT UNLOCK;
GRANT ALL PRIVILEGES ON *.* TO ‘admin‘@‘%‘ WITH GRANT OPTION;
-- Grants for ‘mysql.session‘@‘localhost‘
CREATE USER IF NOT EXISTS ‘mysql.session‘@‘localhost‘;
ALTER USER ‘mysql.session‘@‘localhost‘ IDENTIFIED WITH ‘mysql_native_password‘ AS ‘*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE‘ REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT
LOCK;GRANT SELECT ON `mysql`.`user` TO ‘mysql.session‘@‘localhost‘;
GRANT SELECT ON `performance_schema`.* TO ‘mysql.session‘@‘localhost‘;
GRANT SUPER ON *.* TO ‘mysql.session‘@‘localhost‘;
-- Grants for ‘mysql.sys‘@‘localhost‘
CREATE USER IF NOT EXISTS ‘mysql.sys‘@‘localhost‘;
ALTER USER ‘mysql.sys‘@‘localhost‘ IDENTIFIED WITH ‘mysql_native_password‘ AS ‘*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE‘ REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT LOCK
;GRANT SELECT ON `sys`.`sys_config` TO ‘mysql.sys‘@‘localhost‘;
GRANT TRIGGER ON `sys`.* TO ‘mysql.sys‘@‘localhost‘;
GRANT USAGE ON *.* TO ‘mysql.sys‘@‘localhost‘;
-- Grants for ‘repl‘@‘%‘
CREATE USER IF NOT EXISTS ‘repl‘@‘%‘;
ALTER USER ‘repl‘@‘%‘ IDENTIFIED WITH ‘mysql_native_password‘ AS ‘*A424E797037BF97C19A2E88CF7891C5C2038C039‘ REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
GRANT ALL PRIVILEGES ON *.* TO ‘repl‘@‘%‘;
-- Grants for ‘root‘@‘localhost‘
CREATE USER IF NOT EXISTS ‘root‘@‘localhost‘;
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH ‘mysql_native_password‘ AS ‘*A8C4A68B1666D4A25F44FE4F1C2E16504D79B3BD‘ REQUIRE NONE PASSWORD EXPIRE NEVER ACCOUNT UNLOCK;
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘localhost‘ WITH GRANT OPTION;
GRANT PROXY ON ‘‘@‘‘ TO ‘root‘@‘localhost‘ WITH GRANT OPTION;
-- Grants for ‘user01‘@‘%‘
CREATE USER IF NOT EXISTS ‘user01‘@‘%‘;
ALTER USER ‘user01‘@‘%‘ IDENTIFIED WITH ‘mysql_native_password‘ AS ‘*C8B27DECB94F864D2395C39D43F5FCA5F82CD447‘ REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
GRANT DELETE, INSERT, SELECT, UPDATE ON `db01`.* TO ‘user01‘@‘%‘;
GRANT DELETE, INSERT, SELECT, UPDATE ON `sysbench`.* TO ‘user01‘@‘%‘;
GRANT USAGE ON *.* TO ‘user01‘@‘%‘;

 

20. pt-show-grants

标签:none   b16   native   show   date   for   update   mys   exist   

原文地址:https://www.cnblogs.com/cyberbit/p/pt-show-grants.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!