MYSQL8.0 源码安装调试环境
环境
CentOS 7.6 64位
下载源码文件
下载地址
https://downloads.mysql.com/archives/community/
下载方式
Product Version:8.0.18
Operating System: Source Code
OS Version:Generic Linux (Architecture Independent)
安装
创建用户和组(root用户执行)
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
解压源码文件(root用户授权后mysql用户执行)
tar xvfz mysql-8.0.19.tar.gz
安装必要软件(root用户执行)
GCC 5.4
下载
http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-5.4.0/gcc-5.4.0.tar.gz
安装
yum install gcc //gcc安装前,需要先安装一个C compiler ,所以需要先借助yum安装一个gcc
yum install gmp gmp-devel zip mpfr gcc-c++ libstdc++-devel mpfr-devel libmpc libmpc-devel //gcc make时的依赖包
tar xvfz gcc-5.4.0.tar.gz
cd gcc-5.4.0
./configure --disable-multilib
make
make install
CMAKE
下载
https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0.tar.gz
安装
tar xvfz cmake-3.17.0.tar.gz
yum install openssl-devel
cd cmake-3.17.0
./bootstrap
make
make install
Boost
下载
https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.gz
安装
tar xvfz boost_1_70_0.tar.gz
cd boost_1_70_0
./bootstrap.sh
./b2 install
ncurses
下载
ftp://ftp.gnu.org/gnu/ncurses/ncurses-6.2.tar.gz
安装
tar xvfz ncurses-6.2.tar.gz
cd ncurses-6.2
./configure
make
make install
编译安装MYSQL(ROOT用户执行)
rpm -e gcc-c++-4.8.5-39.el7.x86_64 //卸载之前yum安装的gcc-c++
rpm -e gcc-4.8.5-39.el7.x86_64 //卸载之前yum安装的gcc
chmod 775 /usr/local
cd mysql-8.0.19
mkdir blddebug
cd blddebug
cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/opt/boost_1_70_0 -DCMAKE_BUILD_TYPE=Debug
ln -sf /usr/local/lib64/libstdc++.so.6 /lib64/libstdc++.so.6
ln -sf /usr/local/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6
make
make install
cd /usr/local/mysql
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
bin/mysqld --initialize --user=mysql
bin/mysql_ssl_rsa_setup
启动MYSQL
mkdir -p /var/log/mariadb/
chmod 775 /var/log/mariadb/
chown mysql:mysql /var/log/mariadb/
mkdir -p /var/run/mariadb/
chmod 775 /var/run/mariadb
chown mysql:mysql /var/run/mariadb
bin/mysqld_safe --user=mysql &
[root@mysql8 mysql]# ps -ef | grep mysql
root 4306 13508 0 22:36 pts/0 00:00:00 /bin/sh bin/mysqld_safe --user=mysql
mysql 4441 4306 23 22:36 pts/0 00:00:02 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/var/lib/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root 4534 13508 0 22:36 pts/0 00:00:00 grep --color=auto mysql