开始准备工作
yum install gcc* c++ * autoconf automake zlib* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* yum install cmake* yum install make
开始编译工作,使用默认编译参数
tar zxvf Percona-Server-5.5.24-rel26.0.tar.gz cd Percona-Server-5.5.24-rel26.0
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_DEBUG=0 -Wno-dev
编译错误
CMake Error at cmake/bison.cmake:78 (MESSAGE): Bison (GNU parser generator) is required to build MySQL.Please install bison. Call Stack (most recent call first): sql/CMakeLists.txt:189 (RUN_BISON)
安装依赖库
yum install bison.x86_64 bison-devel.x86_64
重新编译
make clean rm -f CMakeCache.txt cmake .... make make install
如果发现以下编译问题
DEFAULT_CHARSET=utf8 -DMYSQL_USER=mysql -DWITH_DEBUG=0 -- MySQL 5.5.24 -- Packaging as: mysql-5.5.24-Linux-x86_64 -- Configuring done CMake Warning (dev) in sql/CMakeLists.txt: Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link interface. Run "cmake --help-policy CMP0022" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target "mysqld" has an INTERFACE_LINK_LIBRARIES property which differs from its LINK_INTERFACE_LIBRARIES properties. INTERFACE_LINK_LIBRARIES: -lpthread;sql;mysys LINK_INTERFACE_LIBRARIES: rt This warning is for project developers. Use -Wno-dev to suppress it.
先安装依赖库
yum install ncurses ncurses-*
编译成功后,开始安装二进制包
#准备工作目录 mkdir -p /data/mysql groupadd mysql useradd -r -g mysql mysql cd /usr/local/mysq chown -R mysql . chgrp -R mysql . scripts/mysql_install_db --user=mysql --datadir=/data/mysql chown -R root . chown -R mysql /data/mysql # Next command is optional cp support-files/my-medium.cnf /etc/my.cnf bin/mysqld_safe --user=mysql & # Next command is optional cp support-files/mysql.server /etc/init.d/mysql.server