select 里面带的值居然是估算的?
摘要:mysql> set profiling=1;Query OK, 0 rows affected, 1 warning (0.07 sec)mysql> select count(1) from wl;+----------+| count(1) |+----------+| 2 |+...
阅读全文
posted @
2014-10-15 13:51
zitong
阅读(202)
推荐(0)
5.1中repair table
摘要:mysql> repair table xs;+---------+--------+----------+----------+| Table | Op | Msg_type | Msg_text |+---------+--------+----------+----------+|...
阅读全文
posted @
2014-09-07 16:31
zitong
阅读(131)
推荐(0)
alter column和modify column
摘要:5.6中,发现其实alter column 和更改modify column 步骤是一样的mysql> create table xs(name varchar(12),age int default 5);Query OK, 0 rows affected (0.34 sec)mysql> ins...
阅读全文
posted @
2014-09-07 16:12
zitong
阅读(4950)
推荐(0)
几个帮助完成影子拷贝的工作的工具
摘要:facebook 的oscshlomi noach openark toolkitpercona toolkitflexviews cdc
阅读全文
posted @
2014-09-07 15:45
zitong
阅读(211)
推荐(0)
数据恢复的脚本
摘要:数据恢复的脚本#!/bin/bashif [ -d /root/`date +%Y-%m-%d` ];then innobackupex --apply-log /root/`date +%Y-%m-%d` >>/var/log/sjhf`date +%Y%m%d`.log 2>&...
阅读全文
posted @
2014-09-03 09:58
zitong
阅读(341)
推荐(0)
binlog-do-db
摘要:如果只是对一个数据库设置,其实没有效果的,其他数据还是会记录binlog的binlog-ignore-db =database b binlog日志里面将不会记录database b的所有相关的操作
阅读全文
posted @
2014-09-02 16:03
zitong
阅读(1331)
推荐(0)
mysql: Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
摘要:mysql: Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
阅读全文
posted @
2014-08-29 15:40
zitong
阅读(958)
推荐(0)
常用的sql优化
摘要:大批量插入数据 myisamalter table 表名 disable keys;load dataalter table 表名 enable keys;*************************************关于innodb的大量数据插入的优化1.因为inndb类型的表示按照主...
阅读全文
posted @
2014-08-26 14:28
zitong
阅读(161)
推荐(0)
通过trace分析优化其如何选择执行计划
摘要:mysql5.6提供了对sql的跟踪trace,通过trace文件能够进一步了解为什么优化其选择执行计划a而不选b执行计划,帮助我们更好的理解优化其的行为。使用方式:首先打开trace,设置格式为json,设置trace最大能够使用的内存大小,避免接续过程中因为默认内存太小而不能够完整显示set o...
阅读全文
posted @
2014-08-26 14:04
zitong
阅读(223)
推荐(0)
通过show profile分析sql语句
摘要:set profling=1;select count(*) from xuehao;show profiles;show profile for query 1;mysql> set profiling=1;Query OK, 0 rows affected, 1 warning (0.00 se...
阅读全文
posted @
2014-08-26 13:52
zitong
阅读(306)
推荐(0)
explain extended;show warnings
摘要:mysql> explain extended select count(*) from xuehao;+----+-------------+-------+------+---------------+------+---------+------+------+----------+-----...
阅读全文
posted @
2014-08-26 13:36
zitong
阅读(984)
推荐(0)
explain select * from xuehao;
摘要:mysql> explain select * from xuehao;+----+-------------+--------+------+---------------+------+---------+------+------+-------+| id | select_type | ta...
阅读全文
posted @
2014-08-26 12:02
zitong
阅读(342)
推荐(0)
通过show status 命令了解各种sql的执行频率
摘要:show status like 'Com_%';Com_select | 1 执行select操作的次数,一次查询只累加1Com_insert | 0 执行insert操作的次数,对于批量插入的insert,只累加一次Com_update | 0 执行...
阅读全文
posted @
2014-08-26 11:49
zitong
阅读(550)
推荐(0)
mysql的逻辑备份和恢复
摘要:备份指定的数据库或此数据库中的某些表mysqldump [options] db_name [tables] >backup.sql备份指定的一个或多个数据库mysqldump --databases 数据库1 [数据库2 数据库3]>backup.sql备份所有的数据库mysqldump --al...
阅读全文
posted @
2014-08-26 10:46
zitong
阅读(202)
推荐(0)
慢查询日志
摘要:慢查询日志记录了所有执行时间超过参数long_query_time(单位:秒)设置值并扫描记录数不小于min_examined_row_limit的所有sql语句的日志,long_query_time默认是10秒,最小为0秒,精度可以到微秒在默认情况下,有两类常见语句不会被记录到慢查询日志,管理语句...
阅读全文
posted @
2014-08-26 10:40
zitong
阅读(295)
推荐(0)
/etc/hosts导致的问题
摘要:今天安装完成orzdba之后,执行./orzdba -l 报如下错误:Usage: Socket::inet_ntoa(ip_address_sv) at /var/lib/mysql/trunk/orzdba line 477.虽然看不懂perl,毕竟也学过点开发语言,去看了源代码,猜想着是不是/...
阅读全文
posted @
2014-08-22 15:04
zitong
阅读(465)
推荐(0)
mysqlbinlog :unknown variable 'default-character-set=gbk'
摘要:mysqlbinlog :unknown variable 'default-character-set=gbk'解决方法:在命令行中加入--no-defaults开关,使用mysqlbinlog --no-defaults binlog文件参见:http://blog.csdn.net/cau99...
阅读全文
posted @
2014-08-22 13:32
zitong
阅读(337)
推荐(0)