安装 cmake ,如果已经安装可以忽略
tar -zxf cmake-2.8.12.2.tar.gz cd cmake-2.8.12.2 ./bootstrap make make install
安装ncurses-devel包
yum install ncurses-devel
安装 mysql
tar -zxf mysql-5.6.16.tar.gz
mkdir -p /usr/local/mysql/mysql-5.6.16
groupadd mysql
useradd -r -g mysql mysql
cd mysql-5.6.16
cmake -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/mysql-5.6.16 -DCURSES_LIBRARY=/usr/lib64/ -DCURSES_INCLUDE_PATH=/usr/include/ -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_NDB_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
将my.cnf文件复制到mysql安装目录下,4G内存配置在附件my.cnf.zip中
安装数据实例
cd /usr/local/mysql/mysql-5.6.16 chown -R mysql . chgrp -R mysql . scripts/mysql_install_db --user=mysql chown -R root . chown -R mysql data
开机启动
cp support-files/mysql.server /etc/init.d/mysql.server chkconfig --add mysql.server
利用TCMalloc优化mysql的性能, TCMalloc依赖libunwind
安装libunwind
tar xzf libunwind-1.1.tar.gz cd libunwind-1.1 ./configure &&make &&make install安装gperftools(TCMalloc)
tar zxf gperftools-2.1.tar.gz cd gperftools-2.1 ./configure &&make && make install echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig打开 mysqld_safe 脚本 (默认在/usr/bin/mysqld_safe)
在此脚本文件开始加入
LD_PRELOAD="/usr/local/lib/libtcmalloc.so"
启动mysql
mysqld_safe --user=mysql & 或 service mysql.server start