发现一个网址整理的挺好,请各位参考:
http://www.chenyudong.com/archives/building-mysql-5-6-from-source.html#i
也可以参考我的另一篇文章,整合到lamp中了:http://www.cnblogs.com/chinas/p/4572281.html
1、编辑脚本cmake_mysql_install.sh,输入以下内容:
#!/bin/bash #下载并安装make yum -y install gcc #排除错误:configure: error: in `/usr/local/src/make-4.1': configure: error: no acceptable C compiler found in $PATH cd /usr/local/src/ wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gz tar zxvf make-4.1.tar.gz cd make-4.1 ./configure make && make install #下载并安装bison cd /usr/local/src/ wget http://alpha.gnu.org/gnu/bison/bison-2.7.91.tar.gz tar zxvf bison-2.7.91.tar.gz cd bison-2.7.91 ./configure make && make install #安装gcc-c++ yum -y install gcc-c++ #for ubuntu: #apt-get install g++ #下载并解压camke cd /usr/local/src/ wget http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz tar zxvf cmake-3.2.2.tar.gz cd cmake-3.2.2 ./bootstrap gmake && gmake install #or #make && make install #下载安装ncurses cd /usr/local/src/ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz tar -zxvf ncurses-5.9.tar.gz cd ncurses-5.9 ./configure make && make install #安装mysql #首先,创建mysql用户、组 groupadd mysql useradd -g mysql mysql -s /usr/sbin/nologin mkdir /usr/local/mysql # 创建目录 mkdir /usr/local/mysql/data # 数据仓库目录 cd /usr/local/src/ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24.tar.gz #解压安装 tar zxvf mysql-5.6.24.tar.gz cd mysql-5.6.24 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql #安装路径 make && make install cd /usr/local/mysql scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql #初始化mysql数据库 # cp support-files/my-medium.cnf /usr/local/mysql/my.cnf #copy配置文件 cp support-files/my-default.cnf /usr/local/mysql/my.cnf chown -R mysql:mysql /usr/local/mysql #更改权限