一、好言
别把最好的时光,浪费在无谓的等待与犹豫不决中。
二、背景
记录下有关sql查询mysql系统变量等信息。
三、mysql一些系统查询
查看索引
SHOW INDEX FROM db.table
查看数据路连接数:
SHOW STATUS LIKE 'Threads%';
SHOW GLOBAL STATUS LIKE 'Thread%';
系统设置最大连接数:
SHOW VARIABLES LIKE '%max_connections%';
显示数据库表信息:
SHOW TABLE STATUS FROM db LIKE table;
某一张表信息:
SHOW TABLE STATUS FROM db LIKE table
查看表信息:
SELECT table_schema, table_name, table_comment FROM
information_schema.tables WHERE ENGINE LIKE 'InnoDB'
SELECT table_schema, table_name, data_free/1024/1024 AS
data_free_MB FROM
information_schema.tables WHERE ENGINE LIKE 'InnoDB' AND
data_free > 100*1024*1024;
说明:data_free该字段是代表空间碎片的大小。
显示每张表的每个字段
SELECT * FROM information_schema.COLUMNS
导入数据
load data infile '/tmp/user-pwd.txt' into table.t_user_pwd fields terminated by ',' enclosed by '"' lines terminated by '\r\n';