How to install the source code under a new machine rhel7.2 mysql-5.6.35
First, pre-preparatory work
1, first install the dependency package, to avoid problems during the installation process
Yum-y install gcc gcc-c++ cmake ncurses-devel autoconf perl perl-devel
2. Download the source package
Source Package Address: https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.35.tar.gz
3. Create MySQL installation directory and data storage directory
[[email protected] liuzhen]# mkdir-p/my/mysql/data//Add the installation directory for installing the database and the directory where the data resides
4. Create user, user group
Useradd-s/sbin/nologin-m-R mysql//Add user name
5. Set directory Permissions
[Email protected] mysql]# chown-r mysql:mysql.
[Email protected] mysql]# chown-r mysql:mysql data
Second, compile and install
1,TAR-ZXVF mysql-5.6.35.tar.gz//Unzip the file
2, CD mysql-5.6.35///into the directory after decompression
3. Configuration
CMake \
-dcmake_install_prefix=/my/mysql \//Set the default installation directory
-dmysql_datadir=/my/mysql/data \/Set Database storage directory
-DSYSCONFDIR=/ETC \//my.cnf path
-dwith_myisam_storage_engine=1 \// support MYIASM engine
-dwith_innobase_storage_engine=1 \// support InnoDB engine
-dwith_memory_storage_engine=1 \// support MEMORY engine
-dwith_readline=1 \// shortcut key function
-dmysql_tcp_port=3306 \// port
-denabled_local_infile=1 \// allow import of data from local
-dwith_partition_storage_engine=1 \// Install support database partition
-dextra_charsets=all \// Install all character sets
-ddefault_charset=utf8 \// default characters
-DDEFAULT_COLLATION=UTF8_GENERAL_CI// Check character
4. Compile and install
Make && make install
5. Initialize MySQL database
./scripts/mysql_install_db--user=mysql--basedir=/my/mysql--datadir=/my/mysql/data--pid-file=/usr/local/mysql/ Data/mysql.pid--tmpdir=/tmp
Third, configure MySQL
1. Setting Configuration Files
CP SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF
2. Configure Environment variables
Vi/etc/profile Add the following two lines
Export Mysql_home= "/my/mysql"
Export path= "$PATH: $MYSQL _home/bin"
Make the configuration file effective
Source/etc/profile
3. Add MySQL to the folder that can control the startup service and name MySQL
CP Support-files/mysql.server/etc/init.d/mysql
4. Start the service
Under the rhel7.2 source installation mysql-5.6.35