1、 安装确保以下系统相关库文件
yum –y install gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libmcrypt* libtool*
2.安装编译环境和需要make的内核环境包ncurses-devel和bison,用yum安装
yum  install    gcc
yum  install    gcc-c++
yum install ncurses-devel
yum install bison
3.建立相应的安装需要的目录

mkdir  -p  /var/mysql/data

4.下载需要的软件包http://www.linuxfromscratch.org/blfs/view/svn/server/mysql.html中可以找到 找到连接后用下面的命令获取:

 

http://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.6/

 

命令如下

wget http://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.6/mysql-5.6.44.tar.gz

wget http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz

5.解压安装cmake
tar  zxvf  cmake-2.8.4.tar.gz
cd   cmake-2.8.4
./bootstrap
gmake && gmake install
6.解压安装第一个mysql
tar zxvf   mysql-5.6.44.tar.gz
cd mysql-5.6.44
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=latin1 \
-DDEFAULT_COLLATION=latin1_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=latin1,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/var/mysql/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306
make && make install
cp support-files/my-medium.cnf /usr/local/mysql/my.cnf
cp  support-files/mysql.server    /etc/init.d/mysql
vi  /etc/init.d/mysql
修改conf=/usr/local/mysql/my.cnf
保存退出
chmod  755  /etc/init.d/mysql
chkconfig  ---add  mysql
chkconfig   mysql  on
groupadd   mysql
useradd  -g  mysql  mysql
chmod +w   /usr/local/mysql
chmoed +w  /var/mysql/data
chown  -R  mysql:mysql   /user/local/mysql
chown  -R  mysql:mysql  /var/mysql/data
/usr/local/mysql/scripts/mysql_install_db
--defaults-file=/usr/local/mysql/my.cnf
--basedir=/usr/local/mysql
--datadir=/var/mysql/data
--user=mysql
/usr/local/mysql/bin/mysqld_safe    &
service   mysql   start    
第一个安装到此完成
第二个安装注意另外找一个目录重新解压mysql压缩包
tar zxvf   mysql-5.6.44.tar.gz
cd mysql-5.6.44
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql2 \
-DMYSQL_UNIX_ADDR=/tmp/mysql2.sock \
-DDEFAULT_CHARSET=latin1 \
-DDEFAULT_COLLATION=latin1_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=latin1,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/var/mysql/data2 \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3307
make && make install
cp support-files/my-medium.cnf /usr/local/mysql2/my.cnf
cp  support-files/mysql.server    /etc/init.d/mysql2
vi  /etc/init.d/mysql2
修改conf=/usr/local/mysql2/my.cnf
保存退出
chmod  755  /etc/init.d/mysql2
chkconfig  ---add  mysql 2
chkconfig   mysql2  on
chmod +w   /usr/local/mysql2
chmoed +w  /var/mysql/data2
chown  -R  mysql:mysql   /user/local/mysql2
chown  -R  mysql:mysql  /var/mysql/data2
 /usr/local/mysql2/scripts/mysql_install_db
--defaults-file=/usr/local/mysql2/my.cnf
--basedir=/usr/local/mysql2
--datadir=/var/mysql/data2
--user=mysql
/usr/local/mysql2/bin/mysqld_safe    &
service   mysql2   start