下载

[Download MySQL 5.6.31]()

假设解压后的路径在 /home/name/mysql/mysql-5.6.31-src.准备安装到目录/home/name/mysql/mysql-5.6.31

安装依赖

sudo apt-get install cmake libncurses5-dev libreadline-dev libbison-dev

编译

cmake -DCMAKE_INSTALL_PREFIX=/home/name/mysql/mysql-5.6.31 -DMYSQL_UNIX_ADDR=/home/name/mysql/mysql-5.6.31/mysql.socket -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,utf8mb4,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/home/name/mysql/data/

安装

make install