mysql可能有用的东西

查询字段名所在的表,比如报错没有字段时,快速找到表
select table_name from information_schema.columns where table_schema='数据库名' and column_name ='字段名'

mysql版本 select version()

出现ERROR 1213 (40001)死锁时,SHOW ENGINE INNODB STATUS,包含死锁原因

show OPEN TABLES where In_use > 0;
show processlist
kill id

查询事务SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX

查询所有数据库,表,字段名,字段注释
select table_schema,table_name, column_name,column_comment from information_schema.columns

给定条件下某个字段有相同的多余1条的SELECT username,count(username) as count FROM table GROUP BY username HAVING count(username) >1

你可能感兴趣的:(mysql,数据库)