Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12

时间:2022-09-13 17:06:18

 

组件 官方网站 直接下载地址 备注
mysql http://dev.mysql.com/downloads/mysql/ http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.12.tar.gz mysql源码
CMake https://cmake.org https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz 编译时使用
Boost http://www.boost.org/ http://120.52.73.44/nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz 编译时使用,必须是Boost 1.59.0
bison http://www.gnu.org/software/bison/ http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz 2.1 or higher

下载完后,上传到服务器的/tmp目录

Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12

然后解压编译

cd /tmp
tar -zxf mysql-5.7.12.tar.gz
tar -zxf cmake-3.5.2.tar.gz
tar -zxf bison-3.0.tar.gz
tar -zxf boost_1_59_0.tar.gz

Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12

安装C++编译器与ncurses

yum install gcc-c++ ncurses-devel

Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12

编译Cmake:

cd /tmp/cmake-3.5.2
.
/bootstrap
gmake

Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12

Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12

编译安装bison

cd /tmp/bison-3.0
.
/configure --prefix=/comexHome/mysql/dpds/bison
make
make install
Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12

编译安装MySQL

cd /tmp/mysql-5.7.12
/tmp/cmake-3.5.2/bin/cmake \
-DCMAKE_INSTALL_PREFIX=/comexHome/mysql \
-DDEFAULT_CHARSET=utf8 \
-DMYSQL_DATADIR=/comexData/mysql \
-DMYSQL_UNIX_ADDR=/comexHome/mysql/mysql.sock \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DWITH_DEBUG=0 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DSYSCONFDIR=/comexHome/mysql/my.cnf \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_BOOST=/tmp/boost_1_59_0

Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12

然后执行安装

make && make install

Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12

安装完毕后执行数据库安装

/comexHome/mysql/bin/mysqld --initialize

 

Linux(CentOS6.5)下编译安装MySQL Community Server 5.7.12