Submitted by wubx on 周六, 2009/03/21 - 00:05
Submitted by wubx on 周五, 2009/03/20 - 17:41
作用:
备份DB中的数据到单表,以防止增加表后少备份了。
#!/usr/bin/perl
# mysql meg
# wubx
use strict;
use DBI;
my $host='172.16.100.1';
my $port='3306';
my $user='root;
my $passwd='';
my $dsn="dbi:mysql:hostname=$host:port=$port";
my $backup="/backup";
my $dbh= DBI->connect($dsn,$user,'');
unless ($dbh)
{
print "Connect error!\n";
Submitted by yejr on 周五, 2009/03/20 - 15:03
同事碰到麻烦,寻求帮忙,问题是这样的:
有个InnoDB表,想要用 LOAD DATA INFILE 的方式倒数据进去,发现报错:table is full。
我看了一下,日志中没有相关可用信息,该表使用的是共享表空间,总共6个ibdata*文件,只有2个文件的修改时间是最新的,觉得可能不是因为表空间慢的缘故,于是尝试插入少量数据试试看先。分多次插入10,20,100条记录都没问题,一次性插入500多条记录时,就又报table is full了。看来,事务没有问题,再把焦点转会表空间问题上来。尝试性的关闭mysqld,新加一个表空间文件,启动,再插入更多数据,发现这次没问题了,搞定。
Submitted by yejr on 周三, 2009/03/18 - 17:11
一朋友发来消息,说他的mysql报错,日志大致如下:
090318 15:16:35 InnoDB: WARNING: over 4 / 5 of the buffer pool is occupied by
InnoDB: lock heaps or the adaptive hash index! Check that your
InnoDB: transactions do not set too many row locks.
InnoDB: Your buffer pool size is 16 MB. Maybe you should make
InnoDB: the buffer pool bigger?
InnoDB: Starting the InnoDB Monitor to print diagnostics, including
InnoDB: lock heap and hash index sizes.
Submitted by yejr on 周二, 2009/03/03 - 10:51
前言:我想,对于新手来说,有个很重要的问题,就是在mysql发生问题时,就束手无策,不知道该做什么了。要么到论坛里发“冰天雪地裸体跪求帮助”或“急急急”之类的帖子,要么在群里狂喊,对解决问题毫无帮助。这个时候,新手们要做的就是,学会看日志,并且找到问题所在,然后尝试自己动手解决,或者把问题描述清楚,让有经验的人士帮忙。本文说下几种常见问题,以及解决问题的丝路。
Submitted by yejr on 周三, 2009/02/25 - 11:49
前言: 今天帮同事处理了一个关于mysql授权的问题,虽是小事,不过不注意的话,还挺头大的,呵呵。
先对比看看下面2个授权信息之间的区别吧:
GRANT SELECT, DELETE, UPDATE, INSERT ON *.* TO 'yejr'@'192.168.0.1' IDENTIFIED BY PASSWORD '*1088950C531DC1BE311435F60B57145D8A49019C'
和
GRANT SELECT, DELETE, UPDATE, INSERT ON `*`.* TO 'yejr'@'192.168.0.1' IDENTIFIED BY PASSWORD '*1088950C531DC1BE311435F60B57145D8A49019C'
呵呵,看起来都很像,没什么问题吧,实际反映到数据库授权表结果变成了:
Submitted by yejr on 周一, 2008/11/10 - 16:23
想要在MySQL 5.1以下的版本中动态抓取提交到MySQL中的查询日志,可以采用tcpdump的方法,大致如下:
tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | egrep -i 'SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL'
eth0指mysqld监听的网卡,330自然是指mysqld监听的端口,正则匹配模式里,可以自己添加想要抓取的SQL语句类型。
Submitted by yejr on 周五, 2007/08/03 - 17:03
错误现象如下:
mysql> DELETE FROM JHF_CP_SPOT_RATE WHERE FRONT_DATE = '20070801';
ERROR 1206 (HY000): The total number of locks exceeds the lock table size
把 delete 改成 select,再explain一下,发现返回结果高达300多万,于是检查 max_write_lock_count 的值,是 8446744073709551615,肯定够用了。
再看看 innodb_buffer_pool_size,我的天,才设置默认的 8M,该死的。加大到合适的值,重启 mysql,一切ok。
还有一招,就是delete时分成多次,每次用 LIMIT 限定记录数,这样也ok :)
Submitted by yejr on 周四, 2007/05/31 - 16:20
原文转自:http://onlinesolutionsmysql.blogspot.com/2007/05/q-webinar-part-4-mysql-cluster.html
Q from Olivier - Are the data nodes MySQL servers too ?
No, the data node is handled by a separate process, ndbd, that only manages data.
Q from Olivier: So, what is MySQL Cluster? A MySQL AB product ?
Technically speaking, MySQL Cluster is a storage engine, based on a network distributed database. From a commercial point of view, we refer at MySQL Cluster as a product. We also provide APIs to access to the Cluster database directly, bypassing the MySQL Server and the storage engine architecture.
Submitted by yejr on 周一, 2007/05/14 - 12:51
os: redhat as4
master: MySQL 4.0.23
slave : MySQL 5.0.37
slave日志中报错信息如下:
060807 11:40:17 [ERROR] While trying to obtain the list of
slaves from the master 'xxx.xxx.xxx:3306', user 'rep' got the
following error: 'Access denied. You need the REPLICATION SLAVE
privilege for this operation'
在master上,执行以下语句查看权限:
mysql>SHOW GRANT FOR 'rep'@'192.168.0.2'\G
*************************** 1. row ***************************
Grants for rep@192.168.0.2: GRANT SELECT, REPLICATION SLAVE ON
*.* TO 'rep'@'192.168.0.2' IDENTIFIED BY PASSWORD 'xxx'
已经授予了 REPLICAION SLAVE 权限了,怎么还会报这个错呢?
页面
最近评论