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要换算成物 ...
随机推荐
- BASE64编码的图片在网页中的显示问题的解决
BASE64位转码有两种: 一种是图片转为Base64编码,这种编码是直接可以在页面通过<img src='base64编码'/>的方式显示 Base64 在CSS中的使用 .demoIm ...
- webstorm2018.1 汉化
https://github.com/pingfangx/TranslatorX 这个百度云 选择webstorm 选择勾选的文件 选择你下载webstorm 的版本 我下载的是2018.1的 之后等 ...
- 神经网络MPLClassifier分类
代码: # -*- coding: utf-8 -*- """ Created on Fri Aug 24 14:38:56 2018 @author: zhen &qu ...
- postman的简单使用
Postman简单的使用 什么是Postman 在程序开发中用于调试网络程序或者跟踪网页请求.可以对网页进行简单的基本信息调试.Postman最早是作用chrome浏览器插件存在的,但是2018年初 ...
- python中json文件处理涉及的四个函数json.dumps()和json.loads()、json.dump()和json.load()的区分
一.概念理解 1.json.dumps()和json.loads()是json格式处理函数(可以这么理解,json是字符串) (1)json.dumps()函数是将一个Python数据类型列表进行js ...
- 移动端click延迟和tap事件
一.click等事件在移动端的延迟 click事件在移动端和pc端均可以触发,但是在移动端有延迟现象. 1.背景 由于早期移动设备浏览网页时内容较小,为了增强用户体验,苹果公司专门为移动设备设计了双击 ...
- 订制rpm包到Centos7镜像中
本文以CentOS 7.4 最小化镜像(CentOS-7-x86_64-Minimal-1708.iso)为模版 要达到的目的: 1.订制所需的rpm软件包集成到iso文件中 2.制作完成的ISO全自 ...
- Flink应用案例:How Trackunit leverages Flink to process real-time data from industrial IoT devices
January 22, 2019Use Cases, Apache Flink Lasse Nedergaard Recently there has been significant dis ...
- torm入门(三)HelloWorld示例
一.配置开发环境 storm有两种操作模式: 本地模式和远程模式.使用本地模式的时候,你可以在你的本地机器上开发测试你的topology, 一切都在你的本地机器上模拟出来; 用远程模式的时候你提交的t ...
- CentOS 安装 ceph 单机版(luminous版本)
一.环境准备 CentOS Linux release 7.4.1708 (Core)一台,4块磁盘(sda.sdb,.sdc.sdd) 192.168.27.130 nceph 二.配置环境 1.修 ...