安装编译依赖
yum
install
gcc gcc-c++ cmake ncurses-devel bison
安装内存优化jemalloc
wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2
tar xjf jemalloc-3.6.0.tar.bz2
cd jemalloc-3.6.0
./configure
make && make install
echo ‘/usr/local/lib‘ > /etc/ld.so.conf.d/local.conf
ldconfig
cmake -DCMAKE_INSTALL_PREFIX=/data/server/mysql -DMYSQL_DATADIR=/data/data/mysql -DSYSCONFDIR=/data/server/mysql -DMYSQL_UNIX_ADDR=/data/data/mysql/mysql.sock -DMYSQL_TCP_PORT=3336 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_DEBUG=0 -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DENABLE_DOWNLOADS=1 -DCMAKE_EXE_LINKER_FLAGS="-ljemalloc" -DWITH_SAFEMALLOC=OFF make #多进程编译 编译很消耗系统资源,小内存可能编译通不过 #make -j `grep processor /proc/cpuinfo | wc -l` && make install make install
初始化MySQL用户、初始化系统表
groupadd mysql useradd -g mysql mysql -d /home/mysql -s /sbin/nologin cd /data/server/mysql chmod a+x ./scripts/mysql_install_db ./scripts/mysql_install_db --user=mysql --basedir=/data/server/mysql --datadir=/data/data/mysql chown -R mysql:mysql /data/data/mysql
安装为系统服务
cd /data/server/mysql
cp support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on
编辑配置文件/etc/my.cnf
my.cnf 见附件
#启动
service mysql start
#停止
service mysql stop
#登录
/data/server/mysql/bin/mysql
本文出自 “智能化未来_XFICC” 博客,请务必保留此出处http://xficc.blog.51cto.com/1189288/1746610
原文地址:http://xficc.blog.51cto.com/1189288/1746610