mysql-server-5.7.25源码编译安装

######################################

一、创建work用户,规划目录

 

 mysql_3311
│   ├── bin
│   ├── conf
│   ├── data
│   ├── docs
│   ├── include
│   ├── lib
│   ├── log
│   ├── man
│   ├── mysql-test
│   ├── share
│   ├── support-files
│   └── tmp

 

 

 

二、准备好安装mysql- server-5.7.25的依赖

 

[root@a8-cloud-dba-db08 install_database]# scl enable devtoolset-8 bash
[root@a8-cloud-dba-db08 install_database]# sh info_system.sh 
centos    version: 7.9.2009
arch         type: x86-64
cpu         cores: 4
mem        sizeGB: 11G
swap       sizeGB: 5.8G
glibc     version: 2.17
libgcrypt version: libgcrypt-1.5.3-14.el7.x86_64
gcc       version: 8.3.1
git       version: 2.39.1
cmake     version: 3.5.2
make      version: 4.2.1
bison     version: 3.0.4
openssl   version: 1.0.2k-fips



Filesystem Type Size Used Avail Use
% Mounted on devtmpfs devtmpfs 5.8G 0 5.8G 0% /dev tmpfs tmpfs 5.8G 0 5.8G 0% /dev/shm tmpfs tmpfs 5.8G 9.4M 5.8G 1% /run tmpfs tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup /dev/mapper/centos-root xfs 50G 9.6G 41G 20% / /dev/sda1 xfs 1014M 246M 769M 25% /boot /dev/sdb1 xfs 466G 83G 384G 18% /data /dev/mapper/centos-home xfs 55G 28G 28G 50% /home tmpfs tmpfs 1.2G 0 1.2G 0% /run/user/0



[root@a8
-cloud-dba-db08 install_database]# cat info_system.sh #!/bin/bash echo "centos version: $(cat /etc/redhat-release |awk '{print $4}')" echo "arch type: $(file /bin/bash |awk '{print $6}' |awk -F',' '{print $1}')" echo "cpu cores: $(cat /proc/cpuinfo |grep processor |wc -l)" echo "mem sizeGB: $(free -h |grep Mem |awk '{print $2}')" echo "swap sizeGB: $(free -h |grep Swap |awk '{print $2}')" echo "glibc version: $(ldd --version |grep GNU |awk '{print $4}')" echo "libgcrypt version: $(rpm -qa|grep libgcrypt|grep -v devel)" echo "gcc version: $(gcc --version |grep GCC|awk '{print $3}')" echo "git version: $(git --version |awk '{print $3}')" echo "cmake version: $(cmake --version|grep version|awk '{print $3}')" echo "make version: $(make --version |grep GNU |grep Make|awk '{print $3}')" echo "bison version: $(bison --version |grep GNU |awk '{print $4}')" echo "openssl version: $(openssl version|awk '{print $2}')" df -Th

 

三、安装准备工具

 

git clone git@github.com:mysql/mysql-server.git
git checkout mysql-5.7.30

git pull

wget https://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
tar -xzvf boost_1_59_0.tar.gz

scl enable devtoolset-8 bash

 

四、生成Makefile

cmake:没有error即可

cmake .  -DBUILD_CONFIG=mysql_release

-DCMAKE_BUILD_TYPE=RelWithDebInfo

-DENABLED_LOCAL_INFILE=ON

-DFORCE_INSOURCE_BUILD=1

-DDEFAULT_CHARSET=utf8mb4

-DDEFAULT_COLLATION=utf8mb4_general_ci

-DWITH_BOOST=./boost_1_59_0

-DMYSQL_TCP_PORT=3311

-DCMAKE_INSTALL_PREFIX=/home/work/mysql_3311

-DMYSQL_DATADIR=/home/work/mysql_3311/data

-DSYSCONFDIR=/home/work/mysql_3311/conf

-DTMPDIR=/home/work/mysql_3311/tmp

-DWITH_ARCHIVE_STORAGE_ENGINE=1

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 > 3311.log.cmake

 

 

结束时刻:

-- Skipping deb packaging on unsupported platform .
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: _GNU_SOURCE;_FILE_OFFSET_BITS=64;HAVE_CONFIG_H;HAVE_LIBEVENT1
-- CMAKE_C_FLAGS:  -fPIC -Wall -Wextra -Wformat-security -Wvla -Wimplicit-fallthrough=2 -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS:  -fPIC -Wall -Wextra -Wformat-security -Wvla -Wimplicit-fallthrough=2 -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_LINK_FLAGS: 
-- CMAKE_CXX_LINK_FLAGS: 
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -std=gnu++03 -DDBUG_OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /data/soft/mysql-server

 

 

 

 

五、编译(能够100%进度即可)

make

make -j 4

 

编译结束时刻:

[ 99%] Linking CXX static library ../archive_output_directory/libsql.a
[ 99%] Built target sql
Scanning dependencies of target mysqld
[ 99%] Building CXX object sql/CMakeFiles/mysqld.dir/main.cc.o
[ 99%] Linking CXX executable mysqld
Scanning dependencies of target pfs_connect_attr-t
[ 99%] Building CXX object storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/pfs_connect_attr-t.cc.o
[ 99%] Building CXX object storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/__/__/__/sql/sql_builtin.cc.o
[ 99%] Building C object storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/__/__/__/mysys/string.c.o
[ 99%] Linking CXX executable pfs_connect_attr-t
[ 99%] Built target pfs_connect_attr-t
[ 99%] Built target mysqld
Scanning dependencies of target udf_example
[ 99%] Building CXX object sql/CMakeFiles/udf_example.dir/udf_example.cc.o
[100%] Linking CXX shared module udf_example.so
[100%] Built target udf_example

 

六、安装:

make install

 

 

配置mysql:

 

 

初始化数据库:

 

update mysql.user set authentication_string=password('root') ;

set password for root@localhost = password('root');

 

 

 

 

 

 

 

 

 

######################

 

posted @ 2019-08-16 17:53  igoodful  阅读(2350)  评论(0编辑  收藏  举报