mk-show-grants - 顾名思义,查看和复制mysql权限。安装方法可以参考这里。
比如我查看用户名为sg的权限:

mk-show-grants -u sg -p’xxxx’ -h localhost |grep sg
– Grants for ’sg’@'localhost’
GRANT ALL PRIVILEGES ON *.* TO ’sg’@'localhost’ IDENTIFIED BY PASSWORD ‘*8A85934FFBB0E2A8B4A14B18133B4619A86E44F5′ WITH GRANT OPTION;

我想复制一个同样权限的的用户,只需要修改下用户名和IP就可。如果想给出删除的语法,加上 -d参数

mk-show-grants -u sg -p’xxxx’ -h localhost -d|grep sg
DROP USER ’sg’@'localhost’;
DELETE FROM `mysql`.`user` WHERE `User`=’sg’ AND `Host`=’localhost’;
– Grants for ’sg’@'localhost’
GRANT ALL PRIVILEGES ON *.* TO ’sg’@'localhost’ IDENTIFIED BY [...]