*把mysqld编译成静态模式
以不带共享库的形式编译mysqld可以提高性能。
在配置行加入下面这个选项可以将mysqld编译成静态模式:
% >./configure -with-mysqld-ldflags=-all-static [--其他配置选项]
配置示例
下面的配置命令经常用于提高MySQL的性能:
% >CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6
-mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"
./configure --prefix=/usr/local --enable-assembler --with-mysqld-ldflags=-all-static
--disable-shared
另一配置实列(实际路径请根据你自己的情况修改 )
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charset=complex
make
make install
--- Install the Database
scripts/mysql_install_db
-- Set the environment
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql
cp support-files/my-medium.cnf /etc/my.cnf
-- Start the server
/usr/local/mysql/bin/safe_mysqld --user=mysql &
--Set the root passwd
/usr/local/mysql/bin/mysqladmin -u root -p password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h *** -p password 'new-password'
*编译MySQL时使用--with--charset=gbk 参数,这样MySQL就会直接支持中文查找和排序了。