1. Installation Environment: CentOS 7 64-bit MySQL 5.7
2. Go to MySQL official website download mysql source installation package, note, must choose the source code version, otherwise cmake will error:
3. Pre-install dependent software:
Yum Install GCC Make Perl Perl-data-dumper
4. Create MySQL users and user groups
First see if you have created:
cat /etc/passwdgrep mysqlcatgrep MySQL
New MySQL user and user group not created:
1 Groupadd MySQL 2 useradd-r-g MySQL MySQL
5. I put the source package in the/tmp directory, unzip the MySQL
tar -zxv-f mysql-5.7. A. tar. gz
6. Create MySQL installation directory and data directory
1 mkdir /usr/local/mysql2mkdir /usr/local/mysql/data
7. Create the Boost folder and copy the boost file to this directory, otherwise CMake will error, this example uses boost_1_59_0.tar.gz
mkdir /usr/local/boostCP /tmp/boost_1_59_0. tar. gz/usr/local/boost/
8. CMake Install MySQL
-dcmake_install_prefix=/usr/local/-dmysql_unix_addr=/usr/local/mysql/-ddefault_charset= -ddefault_collation=-dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_memory_storage_engine=1 -dwith_readline=1 -denabled_local_infile=1 -dmysql _datadir=/usr/local/mysql/-dmysql_user=-dmysql_tcp_port=3306 -dwith_boost=/usr /local/boost/boost_1_59_0. tar. gz
9. The installation process lasts for a period of time and waits patiently.
Make Make Install
10. Modify/ETC/MY.CNF after installation is complete
Vim/etc/my.cnf
[Mysqld]basedir=/usr/local/mysqldatadir=/usr/local/mysql/datasocket=/usr/local/ mysql/mysql.socksymbolic-links=0Skip-grant-tables[mysqld_safe]log-error=/ usr/local/mysql/logs/mysql.logpid-file=/usr/local/mysql/localhost.localdomain.pid !INCLUDEDIR/ETC/MY.CNF.D
mkdir /usr/local/mysql/logs
11. Modify the MySQL directory owner
chown -R mysql:mysql/usr/local/mysql
12. Add MySQL Service
CP /usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
13. Start MySQL
Service MySQL Start
Show startup success: Starting MySQL .... success!
14. Turn on MySQL
/usr/local/mysql/bin/mysql-uroot-p
15. Complete!
CentOS 7 Installation MySQL 5.7