pt-show-grants的用法
pt-show-grants的用法
1、先查找所有用户和Host
2、然后逐个执行show grants
pt-show-grants的功能是格式化打印输出MySQL上的赋权,以便你可以有效地复制、比较以及版本控制。
[mysql@db130 ~]$ pt-show-grants --user=root --host=localhost --port=3306 --socket=/data/mysql/percona_server/run/mysql.sock --password="xxx" --charset=utf8mb4
-- Grants dumped by pt-show-grants
-- Dumped from server Localhost via UNIX socket, MySQL 5.6.41-84.1-log at 2019-03-27 14:51:02
-- Grants for 'root'@'127.0.0.1'
GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY PASSWORD '*B9C917EC2C16F9047157E4F6A12E158E5D5B86B2' WITH GRANT OPTION;
-- Grants for 'root'@'localhost'
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*B9C917EC2C16F9047157E4F6A12E158E5D5B86B2' WITH GRANT OPTION;
GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION; # 增加 --drop参数
[mysql@db130 ~]$ pt-show-grants --user=root --host=localhost --port=3306 --socket=/data/mysql/percona_server/run/mysql.sock --password="xxx" --drop
-- Grants dumped by pt-show-grants
-- Dumped from server Localhost via UNIX socket, MySQL 5.6.41-84.1-log at 2019-03-27 14:48:12
DROP USER 'root'@'127.0.0.1';
DELETE FROM `mysql`.`user` WHERE `User`='root' AND `Host`='127.0.0.1';
-- Grants for 'root'@'127.0.0.1'
GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY PASSWORD '*B9C917EC2C16F9047157E4F6A12E158E5D5B86B2' WITH GRANT OPTION;
DROP USER 'root'@'localhost';
DELETE FROM `mysql`.`user` WHERE `User`='root' AND `Host`='localhost';
-- Grants for 'root'@'localhost'
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*B9C917EC2C16F9047157E4F6A12E158E5D5B86B2' WITH GRANT OPTION;
GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION;
[mysql@db130 ~]$
[mysql@db130 ~]$ pt-show-grants --help
pt-show-grants shows grants (user privileges) from a MySQL server. For more
details, please use the --help option, or try 'perldoc
/usr/local/bin/pt-show-grants' for complete documentation. Usage: pt-show-grants [OPTIONS] [DSN] Options: --ask-pass Prompt for a password when connecting to MySQL
--charset=s -A Default character set
--config=A Read this comma-separated list of config files; if
specified, this must be the first option on the command
line
--database=s -D The database to use for the connection
--defaults-file=s -F Only read mysql options from the given file
--drop Add DROP USER before each user in the output
--flush Add FLUSH PRIVILEGES after output
--[no]header Print dump header (default yes)
--help Show help and exit
--host=s -h Connect to host
--ignore=a Ignore this comma-separated list of users
--only=a Only show grants for this comma-separated list of users
--password=s -p Password to use when connecting
--pid=s Create the given PID file
--port=i -P Port number to use for connection
--revoke Add REVOKE statements for each GRANT statement
--separate List each GRANT or REVOKE separately
--set-vars=A Set the MySQL variables in this comma-separated list of
variable=value pairs
--socket=s -S Socket file to use for connection
--[no]timestamp Add timestamp to the dump header (default yes)
--user=s -u User for login if not current user
--version Show version and exit Option types: s=string, i=integer, f=float, h/H/a/A=comma-separated list, d=DSN, z=size, m=time Rules: This tool accepts additional command-line arguments. Refer to the SYNOPSIS and usage information for details. DSN syntax is key=value[,key=value...] Allowable DSN keys: KEY COPY MEANING
=== ==== =============================================
A yes Default character set
D yes Default database
F yes Only read default options from the given file
P yes Port number to use for connection
S yes Socket file to use for connection
h yes Connect to host
p yes Password to use when connecting
u yes User for login if not current user If the DSN is a bareword, the word is treated as the 'h' key. Options and values after processing arguments: --ask-pass FALSE
--charset (No value)
--config /etc/percona-toolkit/percona-toolkit.conf,/etc/percona-toolkit/pt-show-grants.conf,/data/mysql/.percona-toolkit.conf,/data/mysql/.pt-show-grants.conf
--database (No value)
--defaults-file (No value)
--drop FALSE
--flush FALSE
--header TRUE
--help TRUE
--host (No value)
--ignore (No value)
--only (No value)
--password (No value)
--pid (No value)
--port (No value)
--revoke FALSE
--separate FALSE
--set-vars
--socket (No value)
--timestamp TRUE
--user (No value)
--version FALSE
[mysql@db130 ~]$
pt-show-grants的用法的更多相关文章
- 百度地图Api进阶教程-点聚合9.html
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- C#开源定时回调库PETimer的使用
PETimer PETimer开源项目GitHub地址:点击跳转 PETimer 1.双端通用:基于C#语言实现的高效便捷计时器,可运行在服务器(.net core/.net framework)以及 ...
- 百度地图api-动态添加覆盖物
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- css中字体单位px,pt,em,百分比之间的区别和用法
px 即像素,一般国内网站使用较多,默认大小是16px; pt 印刷行业常用单位 em 相对单位,相对父元素属性的单位 ,一般用于移动端布局 rem 结合相对定位和绝对定位的优势,相对根元素htm ...
- mysql瑞士军刀–pt工具
Percona-Toolkits Percona-toolkit 简介 percona-toolkit是一组高级命令行工具的集合,用来执行各种通过手工执行非常复杂和麻烦的mysql任务和系统任务,这些 ...
- C++中const 的各种用法
C++中const 关键字的用法 const修饰变量 const 主要用于把一个对象转换成一个常量,例如: ; size = ; // error: assignment of read-only v ...
- Tcpdump的详细用法
1. TCPDump介绍 TcpDump可以将网络中传送的数据包的"头"完全截获下来提供分析.它支持针对网络层.协议.主机.网络或端口的过滤,并提供and.or.not等逻辑语句来 ...
- 必备:常用px,pt,em换算表(转)
常用px,pt,em换算表 pt (point,磅):是一个物理长度单位,指的是72分之一英寸. px (pixel,像素):是一个虚拟长度单位,是计算机系统的数字化图像长度单位,如果px要换算成物理 ...
- SQL LOADER 的用法 TXT文件导入非常之快
前提,需要本地安装ORACLE 客户端 控制文件 cms.ctl load dataCHARACTERSET UTF8infile 'oracle.txt'APPEND INTO TABLE JR f ...
- px,pt,em,rem
一直对px,pt,em,rem的认识有误区,现整理一下,供参考.之后还得整理下关于dpi相关的知识. px(pixe,像素l):是一个虚拟长度单位,是计算机系统的数字化图像长度单位,如果px要换算成物 ...
随机推荐
- Dynamics 365中的批量删除作业执行频率可以高于每天一次吗?
微软动态CRM专家罗勇 ,回复317或者20190314可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!我的网站是 www.luoyong.me . 我先来做一个例子,登 ...
- weblogic patch log显示
如何在WebLogic 12.1.3 版本的 server log 中显示 opatch 的补丁信息? 打补丁 patch 23558563 之后. 需要在 JAVA_OPTIONS 中添加如下参数 ...
- Python使用Plotly绘图工具,绘制直方图
今天我们再来讲解一下Python使用Plotly绘图工具如何绘制直方图 使用plotly绘制直方图需要用到graph_objs包中的Histogram函数 我们将数据赋值给函数中的x变量,x = da ...
- 码云代码托管平台与TortoiseSVN的使用
1.到https://gitee.com/进行注册,然后登陆 可以发现可以将项目设为私有 2.下载tortoisesvn,一路next安装即可 3.项目创建 4.下载项目 5.创建文件并提交 6.如何 ...
- mysql 导出数据报错: row must be in range 0-65535
数据导出时,出现错误: 一脸懵逼,百度了下,是导出数量有格式有限制.一开始导出为excel表格式,后改为文本格式,不会报错.
- Win7下emacs简单配置
;;win7下.emacs在C:\Users\用户名\AppData\Roaming目录下 在.emacs文件中添加 ;; cancel welcome page取消欢迎界面(setq inhibit ...
- C#:往数据库插入/更新时候关于NUll空值的处理
前几天遇到一个问题,找了好久才找到解决办法.不过也很开心,终于解决了. 问题:前端当我数据为空的时候不赋值,传到后台也为空的时候(注意:是Null不是""),SqlCommand对 ...
- Oracle 11g全表扫描以Direct Path Read方式执行
在Oracle Database 11g中有一个新特性,全表扫描可以通过直接路径读的方式来执行(Direct Path Read),这是一个合理的变化,如果全表扫描的大量数据读取是偶发性的,则直接路径 ...
- openstack基础框架
openstack组件: Computer--代码名Nova,管理VM的整个生命周期,主要职责包括启动,调度VMs,计算节点上需要至少两块网卡 Networking--代码名Neutr ...
- 腾讯通信云服务端使用心得,腾讯云IM
腾讯通信云服务端使用心得 1.腾讯通信服务入口并创建应用 方便使用保留url地址 : https://cloud.tencent.com/product/im 注册账号腾讯云账号->通过审核 ...