1)下载必须的
#cd /data/soft
# wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21.tar.gz
# tar -xfzf mysql-5.7.21.tar.gz
5.7版本需要下载一个Boost C++ 1.59.0,(下载比较慢)
# wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
# tar -xfzf boost_1_59_0.tar.gz
# mkdir /usr/local/boost
#mv boost_1_59_0/* /usr/local/boost/
2)安装依赖包:
#yum -y install gcc gcc-c++ ncurses ncurses-devel bison libgcrypt perl make cmake
3)编译安装mysql
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
原文地址:http://blog.51cto.com/6290105/2125686