1,下载
mysql-5.6.46.tar.gz
boost_1_59_0.tar.gz
2,安装依赖
yum install gcc gcc-c++ cmake ncurses-devel bison libaio-devel libncurses-devel libopenssl-devel zlib-devel autoconf perl per-devel make openssl-devel
3,解压
tar -zxvf mysql-5.6.46.tar.gz
tar -zxvf boost_1_59_0.tar.gz
4,创建文件夹
mkdir -p /usr/local/data/mysql/etc
mkdir -p /usr/local/data/mysql/data
5,编译安装
groupadd mysql
useradd mysql -g mysql -M -s /sbin/nologin
export INSTALL_DIR=/usr/local/data/mysql
export PATH_TO_MYSQL=/usr/local/data/tools/mysql-server-mysql-5.6.46
export PATH_TO_BOOST=/usr/local/data/tools/boost_1_59_0
echo ${PATH_TO_MYSQL}
cd ${PATH_TO_MYSQL} && mkdir build && cd build
cmake ${PATH_TO_MYSQL} -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DWITH_BOOST=${PATH_TO_BOOST} -DMYSQL_DATADIR=/usr/local/data/mysql/data -DSYSCONFDIR=/usr/local/data/mysql/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk
make && make install
6,生成数据
cd /usr/local/data/mysql/
chown -R mysql:mysql .
scripts/mysql_install_db --user=mysql
chown -R root:mysql .
chown -R mysql:mysql ./data
chmod -R ug+rwx .
7,启动
bin/mysqld_safe --user=mysql &