#i386体系结构的
CFLAGS="-O3 -mcpu=pentiumpro" CXX=gcc CXXFLAGS="-O3 -mcpu=pentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --with-raid --enable-thread-safe-client --enable-assembler --with-server-suffix =" for >>>MySQL Database of ZhuLuGameDB by wqh <<<" --without-debug --with-extra-charsets=none --without-isam --disable-shared --with-mysqld-ldflags=-all-static --prefix=/usr/local/mysql --without-bench
#64位系统,x86_64
CFLAGS="-O3 -m64" CXX=gcc CXXFLAGS="-O3 -m64 -felide-constructors -fno-exceptions -fno-rtti" ./configure --with-raid --enable-thread-safe-client --enable-assembler --with-server-suffix =" for >>>MySQL Database of Zebra by Yhc<<<" --without-debug --with-extra-charsets=none --without-isam --disable-shared --with-mysqld-ldflags=-all-static --prefix=/usr/local/mysql --without-bench
#然后根据CPU数量进行编译
make -j 1 && make install
#添加用户
groupadd mysql && useradd -g mysql mysql
#创建目录
mkdir /usr/local/mysql/data && mkdir /usr/local/mysql/run && mkdir /usr/local/mysql/log && mkdir /usr/local/mysql/var
#更改mysql目录所有者
chgrp mysql -R /usr/local/mysql && chown mysql -R /usr/local/mysql
#增加打开文件数量
ulimit -n 4096
#添加PATH
echo " PATH=/usr/local/mysql/bin:$PATH" >> /etc/profile && export PATH=$PATH:/usr/local/mysql/bin
#strip可执行文件
strip /usr/local/mysql/libexec/mysqld
#添加LIB PATH && 将mysql动态库加载到高速缓存/etc/ld.so.cache中
echo "/usr/local/mysql/lib" >> /etc/ld.so.conf && ldconfig
#将my.cnf文件cp到/etc目录下
cp support-files/my-huge.cnf /etc/my.cnf
#修改my.cnf
[mysqld]下增加
datadir=/db/mysql
#创建数据库存放路径
mkdir /db
chown mysql.mysql /db -R
#初始化Mysql表
su - mysql -c "mysql_install_db"
#启动服务器(skip-name-resolve参数是必须的)
su - mysql -c "mysqld_safe --skip-name-resolve --open-files-limit=4096&"
本文出自 “Mr_Z” 博客,请务必保留此出处http://zhangrong.blog.51cto.com/2196532/758496