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.gzyum 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
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
編譯安裝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
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