1, download the MySQL source tarball, and cmake RPM package:
Boost_1_59_0.tar.gz
Mysql-5.7.19.tar.gz
cmake-2.8.12.2-4.el6.x86_64.rpm
2, unzip the package, and move to the corresponding position (not fixed):
CP-RF Boost_1_59_0/usr/local/boost
CP-RF Mysql-5.7.19/usr/local/mysql
3. Create users and Groups:
Groupadd MySQL
useradd-g MySQL MySQL
4. Install the Build Environment Dependency package (configure Yum and mount it):
Yum install gcc gcc-c++-y
Yum Install-y ncurses-devel.x86_64
Yum Install-y cmake.x86_64
Yum Install-y libaio.x86_64
Yum Install-y bison.x86_64
Yum Install-y gcc-c++.x86_64
5, installation CMake:
Yum-y Localinstall cmake-2.8.12.2-4.el6.x86_64.rpm
6. Create a directory:
Mkdir-p/home/mysql3306/mysql3306
Mkdir-p/home/mysql3306/logs
Assigning permissions to a directory:
Chown-r Mysql:mysql/usr/local/mysql
Chown-r mysql:mysql/home/mysql3306
7. Compile and install the MySQL installation directory:
Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/home/mysql3306/mysql3306-ddefault_charset=utf8- Dextra_charsets=all-dsysconfdir=/etc-denabled_local_infile=1-dmysql_unix_addr=/tmp/mysql.sock-ddefault_ Collation=utf8_general_ci-dmysql_tcp_port=3306-dmysql_user=mysql-dwith_myisam_storage_engine=1-dwith_innobase_ Storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith_memory_storage_engine=1 -dwith_boost=/usr/local/boost
8. Execute after completion: Make && make install
9. Adding Mysql.server to the service (varies from person to person, not required):
Cd/usr/local/mysql/support-files
CP Mysql.server/etc/init.d/mysqld
chmod 755/etc/init.d/mysqld
10. Configure MySQL configuration file my.cnf (here the configuration file is too simple to add as needed):
#vim/etc/my.cnf
[Mysqld]
Basedir =/usr/local/mysql
DataDir =/home/mysql3306/mysql3306
Port = 3306
#character UTF8
Character_set_server=utf8
init_connect= ' SET NAMES UTF8 '
[Client]
Default-character-set=utf8
Socket=/tmp/mysql.sock
11. Initialize MySQL (5.7 Note initialization command):
/usr/local/mysql/bin/mysqld--defaults-file=/etc/my.cnf--initialize-insecure--basedir=/usr/local/mysql--datadir =/home/mysql3306/mysql3306/--user=mysql
12. Start MySQL service: Services mysqld start
13. Enter MySQL initialization permission to change the password to root. Because the--initialize-insecure parameter is added when initializing, the default password will be generated in error log if not added.
Redhat compiling and installing MySQL