– 查询MySQL版本
select version() from dual;
– 查看数据库字符串拼接长度
show variables like 'group_concat_max_len';
– 显示MySQL最大连接数
show variables like '%max_connections%';
– 修改最大连接数
-- set GLOBAL max_connections = 200;
– 服务器响应的MySQL最大连接数—比较理想的设置是: Max_used_connections /
max_connections * 100% ≈ 85%
show status like '%connections%';
– 查看MySQL线程
show status like '%Threads%';
– mysql中查看索引占用的存储空间使用下面的sql语句
SELECT
table_name,
concat( TRUNCATE ( data_length / 1024 / 1024, 2 ), 'MB' ) AS data_size,
concat( TRUNCATE ( index_length / 1024 / 1024, 2 ), 'MB' ) AS index_size
FROM
information_schema.TABLES
WHERE
table_name = 'ec_order'
ORDER BY
index_size DESC;
– 查看单个表的细分索引情况:
select TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,CARDINALITY from
information_schema.STATISTICS iss
where iss.table_name='ec_order';
– 查询表及索引占用空间
select * from information_schema.TABLES
where information_schema.TABLES.TABLE_SCHEMA='ftms_union' and
information_schema.TABLES.TABLE_NAME='ec_order'
– 查询Sql模板
select @@global.sql_mode