06 2011 档案
摘要:读取binlog,方法有二:1.使用mysqlbinlog,详细用法,请参考MySQL手册 2.使用MySQL的自带工具,SHOW BINLOG EVENTS读取relaylog,在5.4.4以后能使用show relay log ,如果要想读取的话,要用mysqlbinlog读取,方法:mysqlbinlog relaylogname
阅读全文
摘要:I have only recently started working heavily with stored procedures and functions in MySQL. After years in the Oracle world with advanced stored procedures, functions and packages, I’ve had to come to grips with the shortcomings of MySQL. One of those is recursive functions. MySQL allows recursive s
阅读全文
摘要:1 drop table if exists employee; 2 3 create table employee 4 ( 5 emp_id smallint unsigned not null auto_increment primary key, 6 name varchar(32) not null, 7 boss_id smallint unsigned null, 8 key boss_id_idx(boss_id) 9 )engine = innodb; 10 11 12 insert into employee (name, boss_id) values 13 ('f
阅读全文
摘要:mysqlhotcopy 是MySQL的热备工具,详细请看手册 ,为了安全起见我们给热备分配个用户:grant select, reload, lock tables on *.* to 'hotcopy'@'localhost' identified by '123456'; 如果我们只想热备其中的一部分数据就有可能用到正则了,使用 mysqlhotcopy --help可以看到它支持的选项,其中有:--regexp 这个正则是和数据库名匹配的,比如:备份以abc开头的库,可以使用:mysqlhotcopy --flushlog -u='
阅读全文
摘要:如果想要我们的SQL语句看起来很美观,除了自己平时注意外,还有一个懒人方法,O(∩_∩)O~第一款在线格式化工具:Instant SQL Formatter功能强劲,可以设置第二款,和第一款类似,功能也一样,只不过是不同的UI而已,SQLPP第三款是针对MySQL的,是作者从phpMyAdmin中抠出来的,php-SQL-Format ,这个在我本地出了点小问题,复杂SQL格式化不了,我和作者沟通,他说有可能是SQLParser的问题,没有深究,我又观察了下,我觉得是过程中传递参数的问题,复杂的SQL语句,返回的是pma中php代码格式。
阅读全文
摘要:接上篇:mysql使用mysql-udf-http效率测试笔记 ,这次不使用rest架构,而是使用:libmemcached和memcached_functions_mysql,测试版本是:libmemcached-0.34.tar.gz和memcached_functions_mysql-0.9.tar.gz,其它版本配对都有问题,我安装测试过有问题的版本有:memcached_functions_mysql-1.1在:libmemcached-0.49\libmemcached-0.48\libmemcached-0.47\libmemcached-0.30\libmemcached-0.
阅读全文
摘要:今天在测试libmemcached的时候,反复安装,反复加载sql,语句,重复创建函数memc_*,所以再次执行SQL之前,需要删除原来的函数,删除语句:DELETE FROM `func` WHERE `name`=function_name' LIMIT 1;而不是:drop function if exists function_name;
阅读全文
摘要:在多数情况下,alter table 工作的时候都会拷贝一个目标表(暂且命名为a)的临时备份(暂且命名为b),alter操作都是在备份文件(b)上操作,然后删除目标表(a),重命名备份表(b)为目标表(a)。当alter table执行的时候,其他会话是可以读目标表(a)的,但是update,write操作会被阻塞,直到b命名为a后,才可以重定向到a,而不会丢失任何DML操作。这个临时表b是和目标表a创建在同一个库下的。 下面是测试过程:alter table cdb_posts drop index fid;drop index fid on cdb_posts;alter table c.
阅读全文

浙公网安备 33010602011771号