cd /tmp/ wget https://github.com/jemalloc/jemalloc/archive/5.2.1.tar.gz yum groupinstall -y 'Development Tools' tar -xzvf 5.2.1.tar.gz cd jemalloc-5.2.1 sh ./autogen.sh ./configure --prefix=/usr/ make -j 8 make install
通过上述命令安装完jemalloc.so后,在mysql配置文件my.cnf中添加如下配置
my.cnf配置
[mysql_safe] malloc-lib=/usr/lib/libjemalloc.so
启动mysql