在Centos5.4上配置MySQL5.5.4-m3的主从复制时在my.cnf里面设置好主从的参数后,MySQL无法启动,查看/var/log/mysql/mysql_error.log发现
/home/DB/mysql/libexec/mysqld: unknown variable ‘master-host=192.168.3.11′ 竟然不认识这个参数?MySQL5.0的一台Slave用这个参数也一直稳定运行.在网上搜索一翻无果,最后只能用手动同步试试去掉/etc/my.cnf里面master-host,master-user这些关于主从配置的参数,启动MySQL,查看日志可以正常启动,进入MySQL后手动执行
mysql> CHANGE MASTER TO
-> MASTER_HOST='master_host_name',
-> MASTER_USER='replication_user_name',
-> MASTER_PASSWORD='
replication_passwor[......]
MySQL5.5.4-m3 复制参数问题
MySQL用Load Data local infile 导入部分数据后中文乱码
今天在两台MySQL服务器之间导数据,因为另一个MySQL服务器是测试用的,差一个月的数据,从现有MySQL服务器select到一个文件,具体语句是:
select * from news where ine_time>=’2010-02-01′ and ine_time <’2010-03-01′ into outfile ‘/tmp/newsdata.sql’;
然后scp到另一个MySQL Server上导入到对应的表中,具体语句如下:
load data local infile ‘/home/lsanotes/newsdata.sql’ into table news;
然后刷新访问这台数据库的web页面,发现刚导进来的这一个月的数据都是乱码,而以前其它月份的则正常,用show create table news;查看发现两个服务器中的news表都是utf8,奇怪,把导出的数据转换成utf8,再导入问题仍旧。
后来在数据库中查看刚刚导进的这一个月的数据时,没有执行set names utf8;就可以正常查看中文而不乱码,而其它月份的必须先执行set n[......]
MySQL 错误 Access denied for user ‘debian-sys-maint’@'localhost’”
今天一台Ubuntu机器上的MySQL调整了一下,重启后会报Access denied for user ‘debian-sys-maint’@’localhost’” 但是使用还没有什么问题.
解决方法如下:
1.cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = 4AiDYEIp8AJIwEe1
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
user = debian-sys-maint
password = 4AiDYEIp8AJIwEe1
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
2.进入MySQL
mysql&g[......]
用Google-perftools的TCMalloc优化MySQL
TCMalloc(Thread-Caching Malloc)可以提高MySQL在内存分配方面的性能和效率,具体请看官方文档
http://google-perftools.googlecode.com/svn/trunk/doc/tcmalloc.html
一.下载软件
wget http://google-perftools.googlecode.com/files/google-perftools-1.4.tar.gz
如果是64位系统请安装libunwind,32位请跳过
wget http://ftp.twaren.net/Unix/NonGNU/libunwind/libunwind-0.99.tar.gz
tar -zxvf libunwind-0.99.tar.gz
cd libunwind-0.99/
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install
二.安装
tar -zxvf google-perftools-1.4.tar.gz
cd google-perftools[......]