进入mysql:
mysql -h192.168.1.101 -uroot -proot
查看某数据库所有表信息
show table status from dbname \G;
查看单个表信息
show table status from dbname like 'table1' \G;
使用某个数据库
use dbname;
查看某表的索引
show index from table1;
查看sql解析
explain select * from table1 where 1=1;
查看系统运行变量
show variables;
show variables like 'long%';
测试mysql计算速度
select benchmark(10000,1+1);
查看mysql版本
mysqld-nt --version --help
查看mysql默认系统变量
mysqld-nt --verbose --help
查看状态
show status;
status
查看正在执行的sql
show processlist;
监测慢sql
mysqldumpslow
放开某个ip访问权限
grant all on *.* to root@"客户端ip" Identified by "password"