作者:x修者x | 来源:互联网 | 2014-05-29 08:43
下载相关软件源码包wgethttp://downloads.mariadb.org/f/mariadb-5.5.27/kvm-tarbake-jaunty-x86/mariadb-5.5.27.tar.gz/from/http:/ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadbwgeth
下载相关软件源码包
wget http://downloads.mariadb.org/f/mariadb-5.5.27/kvm-tarbake-jaunty-x86/mariadb-5.5.27.tar.gz/from/http:/ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb
wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
安装cmake,
mysql-5.5后需要使用cmake配置
tar zxf cmake-2.8.5.tar.gz
cd cmake-2.8.5
./bootstrap
make
make install
cd ..
#配置编译器,提高性能
CFLAGS="-O3"
CXX=gcc
CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
#mysql-5.1版本使用以下编译参数,5.5以前添加以下参数增加性能
#./configure ?prefix=/usr/local/mysql ?enable-assembler
?with-mysqld-ldflags=-all-static
开始安装mariadb
yum install ncurses-devel -y
yum install libaio-devel -y
useradd mysql
tar -zxvf mariadb-5.5.27.tar.gz
cd mariadb-5.5.27
cmake . -LH|more //CMake下查看MySQL的编译配置
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariamysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DBUILD_COnFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF
make -j 8 //-j指定用于编译的CPU核数,可以加快编译速度
make install
cp support-files/my-innodb-heavy-4G.cnf /etc/my.cnf
/usr/local/mariamysql/scripts/mysql_install_db --basedir=/usr/local/mariamysql/ --datadir=/usr/local/mariamysql/data/ --user=mysql
/usr/local/mariamysql/bin/mysqld_safe --user=mysql &
注意问题:编译 cmake 确保系统安装了 gcc 和 g++(gcc-c++)