1、查询某用户在该主机mysql上授权语句
show grants for 用户名
@127.0.0.1
;
2、查询所有用户在mysql数据库中的授权语句
select concat('show grants for ','',user,'
','@','',host,'
',';') from mysql.user;
+--------------------------------------------------------------+
| concat('show grants for ','',user,'
','@','',host,'
',';') |
+--------------------------------------------------------------+
| show grants for root
@127.0.0.1
; |
| show grants for yunwei
@127.0.0.1
; |
| show grants for root
@localhost
; |
| show grants for yunwei
@localhost
; |
+--------------------------------------------------------------+
然后复制查询出来的语句,在mysql上执行就出来了授权
3、查看mysql历史执行命令 查看历史文件 /root/.mysql_history
转载于:https://blog.51cto.com/wangyan112/2399695