存档

文章标签 ‘Tips’

MySQL Tips 实用的小技巧

2009年3月27日 谭俊青 没有评论

#/etc/my.cnf

[mysql]
prompt=”\\u:\\d> ”
pager=more

#更多请参考:
http://www.mysqlab.net/docs/refman/en-5.1/page/mysql-commands.html

#将库中是myisam引擎的表转成innodb

select concat(‘alter table ‘, TABLE_SCHEMA, ‘.’, TABLE_NAME, ‘ engine=innodb;’) from information_schema.TABLES where ENGINE=’Myisam’ and TABLE_SCHEMA<>’mysql’ and TABLE_SCHEMA<>’information_schema’ into outfile ‘/tmp/ivan_alter.sql’ ;

source /tmp/ivan_alter.sql

#看都有哪些sql没走索引

set global log_queries_not_using_indexes=on;

# 临时提高innodb的性能,比如在raid卡电池没电的时候,风险自担。

set global innodb_flush_log_at_trx_commit = 2;

#……

分类: MySQL 标签: