Chinaunix首页 | 论坛 | 博客
  • 博客访问: 266960
  • 博文数量: 42
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 534
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-26 19:11
文章分类
文章存档

2014年(42)

我的朋友

分类: 数据库开发技术

2014-06-07 14:06:44

每天进步一点点

1,2011-09-08
-- ===============================================================
-- mysql root 管理软件
-- ===============================================================
监控并发软件:Mysqlslap


-- ===============================================================
-- 查询数据库的字符集合
-- ===============================================================
select distinct table_schema,table_collation from information_schema.TABLES
where table_schema not in
('performance_schema','sys','test','mysql','information_schema');

select distinct table_schema,table_collation, table_name from information_schema.TABLES
where table_schema not in
('performance_schema','sys','test','mysql','information_schema')   ;

-- 修改表的字符集
alter table cam.account charset utf8;



-- 建库
delimiter $$
CREATE DATABASE `csf_fdp` /*!40100 DEFAULT CHARACTER SET utf8 */$$



2, 2011-09-08
-- ===============================================================
-- 设置mysql slow log 开启select语句检测
-- ===============================================================
long_query_time = 1
log-slow-queries = /usr/local/mysql/data/slow.log
log-queries-not-using-indexes

在线关闭slow log
set global slow_query_log='off';
show variables like '%slow%';
SELECT * FROM `test`.`report_data` order by rpt_post_time desc limit 10,100000;
-- slow log 没有写入记录

在线开启slow log
set global slow_query_log='on';
show variables like '%slow%';
SELECT * FROM `test`.`report_data` order by rpt_post_time desc limit 20,100000;
-- slow log 有写入记录

5.1.40以上肯定支持的,set global slow_query_log='off'; set global slow_query_log='on';

[ 本帖最后由 mchdba 于 2011-9-8 11:17 编辑 ]
阅读(2378) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~