命令行 | 作用 |
show engines; | 查看存储引擎 |
select database(); | 查看当前数据库 |
show databases; | 查看数据库列表 |
show create database test; | 查看数据库test的建表语句 |
show tables; | 查看当前数据库下的表 |
show tables from test | 查看数据库test下的表 |
show create table xxx; | 查看表xxx的建表语句 |
show index from table_name(表名) | 查看表的索引 |
select user(); | 查看当前用户 |
show engine innodb status\G | 查看InnoDB春初引擎的状态信息 |
grant insert,delete,update,select,execute on db.* to user@‘0.0.0.0’; | 授权 表的增删改查,函数存储过程的执行 |
revoke insert,delete,update,select,execute on db.* from user@‘0.0.0.0’; | 回收权限 表的增删改查,函数存储过程的执行 |
show grants for ‘xxx’@‘xxx’ | 查看用户的权限信息 |
show create user ‘xxx’@‘xxx’ | 查看用户的属性信息 |
show columns from columns_priv like ‘%ab%’ | 查看含有ab字样的字段 |
show processlist; | 查看mysql线程列表 |
select * from information_schema.PROCESSLIST where info is not null\G | 查看mysql当前语句,可以看完整语句 |
show status; | 查看mysql状态 |
show variables like ‘%xx%’; | 查看含有xx字样的参数 |
show variables where Variable_name in (‘slow_query_log’, ‘log_output’, ‘long_query_time’, ‘log_slow_admin_statements’, ‘slow_query_log_file’); | 查看某几个参数 |
show global status; | 查看mysql全局状态 |
select user,host from mysql.user; | 查看用户列表信息 |
select * from information_schema.routines | 查看存储过程列表 |