MySQL整理

修改密码后生效:

flush privileges

查询MySQL引擎:

show engines

查询MySQL参数:

# 可以使用like查询:show variables like "ft%"
show variables

重建索引:

REPAIR TABLE table_name QUICK

查询某个表的索引:

SHOW INDEX FROM table_name

时间消耗查询:

set profiling = 1;show profiles

查询包含某个字段的所有表:

SELECT * FROM information_schema.columns WHERE column_name='field'

语句优化查询:

explain select * from table_name

绿色版MySQLmysql-5.7.13-winx64.zip在Window上面安装命令:

# 初始化生成data文件夹,以前使用mysqld install的
mysqld --initialize
net start mysql

分组查询不重复:

select * from tb group by field1 having count(distinct field2) > 1;