mysql5.1.51编译_32位系统静态编译TCMalloc到Mysql5.1.51(Linux CentOS 5.5)

下载google-perftools-1.6.tar.gz

tar zxvf google-perftools-1.6.tar.gz

执行./configure

make && make install

ldconfig

可以看到/usr/local/lib下出现了以libtcmalloc开头的so文件

echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf

/sbin/ldconfig

安装mysql5.1.51

要执行的预编译指令

CFLAGS="-O3"

CXX=g++

CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"

yum install gcc

yum install gcc-c++

groupadd mysql

useradd --shell /sbin/nologin -g mysql mysql

tar zxvf mysql-5.1.51.tar.gz

cd mysql-5.1.51

mkdir -p /usr/local/mysql/data

./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=gbk,gb2312,latin1,binary --without-docs --with-mysqld-user=mysql --localstatedir=/usr/local/mysql/data --with-big-tables --without-ndb-debug --with-pthread --enable-assembler --with-mysqld-ldflags=-all-static --with-mysqld-ldflags=-ltcmalloc --with-client-ldflags=-all-static --enable-thread-safe-client

make

make install

cp support-files/my-medium.cnf /etc/my.cnf

cp support-files/mysql.server /etc/init.d/mysql

chmod u+x /etc/init.d/mysql

cd /usr/local/mysql

bin/mysql_install_db --user=mysql

chown -R root .

chown -R mysql data

chgrp -R mysql .

chkconfig --add mysql

chkconfig --level 345 mysql on

bin/mysqld_safe --user=mysql &

service mysql restart

ln -s /usr/local/mysql/bin/mysql /sbin/mysql

ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin

mysqladmin -uroot password "yourpassword"

修改MySQL启动脚本(根据你的MySQL安装位置而定):

vi /usr/local/mysql/bin/mysqld_safe

在# executing mysqld_safe的下一行,加上:

export LD_PRELOAD=/usr/local/lib/libtcmalloc.so

保存后退出,然后重启MySQL服务器。

4、使用lsof命令查看tcmalloc是否起效:

/usr/sbin/lsof -n | grep tcmalloc

如果发现以下信息,说明tcmalloc已经起效:

mysqld    10847   mysql  mem       REG        8,5  1203756   20484960 /usr/local/lib/libtcmalloc.so.0.0.0

在 CentOS 5.5 下编译安装MySQL时出错:/bin/rm: cannot remove `libtoolT': No such file or directory解决方法是:在执行./configure 之前,先执行:# yum install automake autoconf libtool# autoreconf --force --install# libtoolize --automake --force# automake --force --add-missing正确运行以上命令后在执行./configure进行编译即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值