1、下载XtraDB
wget -c http://www.percona.com/mysql/xtradb/5.1.37-7/source/MySQL-percona-5.1.37-7.rhel5.src.rpm
2、下载下来是rpm源码包,使用rpm解包
rpm -ivh MySQL-percona-5.1.37-7.rhel5.src.rpm
3、解压源码包
cd /usr/src/redhat/SOURCES
tar -zxvf mysql-5.1.37.tar.gz
tar -zxvf percona-xtradb-1.0.3-7.tar.gz
4、覆盖innobase源码
mv mysql-5.1.37/storage/innobase/ ~/
cp -R percona-xtradb-1.0.3-7 mysql-5.1.37/storage/innobase
cd mysql-5.1.37
patch -p1 < ../percona-support.patch
5、创建组和用户
groupadd mysql
useradd -g mysql mysql
6、编译安装
CC="ccache /usr/local/gcc-4.3.2/bin/gcc -static-libgcc"
CFLAGS="-O3 -march=i686 -mpentiumpro -mstack-align-double"
CXX="ccache /usr/local/gcc-4.3.2/bin/gcc -static-libgcc"
CXXFLAGS="-O3 -march=i686 -mpentiumpro -mstack-align-double -felide-constructors -fno-exceptions -fno-rtti"
./configure
--prefix=/usr/local/mysql-xtradb --datadir=/usr/local/mysql-xtradb/data
--with-mysqld-user=mysql
--with-server-suffix=-xtradb
--with-plugins=partition,archive,blackhole,csv,innobase,federated
--with-extra-charsets=complex --with-charset=utf8 --with-collation=utf8_general_ci
--with-big-tables
--with-ssl
--with-fast-mutexes
--with-zlib-dir=bundled
--with-client-ldflags=-static
--with-mysqld-ldflags=-static
--with-pic --enable-assembler --enable-local-infile
--enable-thread-safe-client
--with-comment="MySQL Community Server (GPL)"
make
make install
7、由于我的系统比较旧,configure过程中遇到了错误以下是解决过程。
/bin/rm: cannot remove `libtoolT': No such file or directory
google得到http://bbs2.chinaunix.net/viewthread.php?tid=1568360
需要在安装目录执行
autoconf
automake
libtoolize --force
7.1、autoconf
报以下错误
configure.in:13: error: Autoconf version 2.60 or higher is required
原来需要升级autoconf
wget -c http://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.gz
tar -zxvf autoconf-2.64.tar.gz
cd autoconf-2.64
./configure --prefix=/usr
make
make install
升级完成后,再执行autoconf,还需要升级m4
checking for GNU M4 that supports accurate traces... configure: error: no acceptable m4 could be found in $PATH.
GNU M4 1.4.6 or later is required; 1.4.13 is recommended
wget -c http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
tar -zxvf m4-1.4.9.tar.gz
cd m4-1.4.9
./configure --prefix=/usr
make
make install
7.2、automake
报错
You should recreate
configure.in:13: aclocal.m4 with aclocal and run automake again.
执行aclocal再automake,还报错
client/Makefile.am: required file `./compile' not found
缺少compile文件,copy一个过来
cp BUILD/compile-pentium-icc ./compile
再执行automake成功
7.3、libtoolize --force
此后再进行mysql的编译安装顺利完成。
8、配置
由于我之前安装有mysql,直接cp了一个my.cnf改了一下端口目录等
9、初始化
cd /usr/local/mysql-xtradb/
bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql-xtradb/data
10、目录权限
chown -R mysql.mysql /usr/local/mysql-xtradb
11、启动
bin/mysqld_safe --defaults-file=/usr/local/mysql-xtradb/my.cnf --user=mysql &
12、测试
bin/mysql -S./mysql.sock
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 6
Server version: 5.1.37-xtradb-log MySQL Community Server with XtraDB (GPL)
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql>
连接成功!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/124805/viewspace-1026850/ ,如需转载,请注明出处,否则将追究法律责任。