contos7安装mysql-5.7.28源代码

contos7安装mysql-5.7.28源代码

首先查看支持的版本:https://www.mysql.com/support/supportedplatforms/database.html

(mysql-5.7.28.tar.gz)
(mysql-boost-5.7.28.tar.gz)
第一种没有boost,需要自己安装。 mysql5.7之后boost-1.19是必须的。

二.安装之前的准备

2.1.卸载自带的mysql

rpm -qa | grep mysql
有的话卸载
rpm -e --nodepes ...

检测系统是否自带mariadb
rpm -qa | grep mariadb

2.2.cmake

which is used as the build framework on all platforms. CMake can be downloaded from http://www.cmake.org.

2.3.安装boost

tar zxvf boost_1_59_0.tar.gz
cd boost_1_59_0
./bootstrap.sh --prefix=/usr/local/boost
./b2 install打开/etc/profile,添加以下内容:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/boost/lib
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/boost/lib
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/boost/include
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/boost/include

source /etc/profile

# Preconfiguration setup
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> mkdir bld
shell> cd bld
shell> cmake ..
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

 chkconfig --add mysql

mysqladmin variables

mysqladmin -h host_name variables