Linux环境下Nginx搭建高性能WEB服务器LEMP(2)

1.3 编译安装 MySQL
#sh install_mysql.sh
//具体脚本如下

:

CHOST="x86_64-pc-linux-gnu"

CFLAGS="-march=nocona -O3 -pipe"

CXXFLAGS="${CFLAGS}"

./configure \

"--prefix=/usr/local/mysql" \

"--localstatedir=/data/mysql/data" \

"--with-comment=Source" \

"--with-server-suffix=-Linuxtone.Org" \

"--with-mysqld-user=mysql" \

"--without-debug" \

"--with-big-tables" \

"--with-charset=gbk" \

"--with-collation=gbk_chinese_ci" \

"--with-extra-charsets=all" \

"--with-pthread" \

"--enable-static" \

"--enable-thread-safe-client" \

"--with-client-ldflags=-all-static" \

"--with-mysqld-ldflags=-all-static" \

"--enable-assembler" \

"--with-plugins=all" \

"--without-ndb-debug"

make

make install

useradd mysql -d /data/mysql -s/sbin/nologin

/usr/local/mysql/bin/mysql_install_db--user=mysql

cd /usr/local/mysql

chown -R root:mysql .

mkdir -p /data/mysql/data

chown -R mysql /data/mysql/data

cp share/mysql/my-huge.cnf /etc/my.cnf

cp share/mysql/mysql.server/etc/rc.d/init.d/mysqld

chmod 755 /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

/etc/rc.d/init.d/mysqld start

cd /usr/local/mysql/bin

for i in *; do ln -s /usr/local/mysql/bin/$i/usr/bin/$i; done
复制代码
【注】编译 mysql前请正确配置好主机名,否则不能正常启动 .
例如 :
[root@lempmysql-5.1.30 ]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1   localhost.localdomainlocalhost

192.168.1.104  lemp.linuxtone.org
复制代码

【注】将本文提供下载的 scripts.tar.gz包中的 my.cnf替换你的 /etc/my.cnf,并根据你的硬件参数做相关调整 ,并可以利用包中的 tuning-primer.sh 做初步性能调优。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyfywx.html