1. Download the source code
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz
2. Unzip
Tar zxvf mysql-5.6.23.tar.gz
3. Install the necessary packages
sudo yum install cmake gcc-c++ ncurses-devel perl-data-dumper
4. Enter the MySQL source directory to generate makefile
CMake.
5. Compiling
Make
6. Installation
sudo make install
MySQL will be installed to the/usr/local/mysql path.
7. Adding MySQL Users and Groups
sudo groupadd mysqlsudo useradd-r-g MySQL MySQL
8. Modify directory and file permissions to install the default database
Cd/usr/local/mysqlsudo chown-r mysql. sudo chgrp-r mysql. sudo scripts/mysql_install_db--user=mysql
sudo chown-r root.
sudo chown-r mysql data
At this point, MySQL can start running.
9. Start MySQL
CentOS7 with MARIADB support,/etc under the default existence of my.cnf files to interfere with MySQL operation, need to first delete
Cd/etcsudo rm-fr my.cnf MY.CNF.D
And so on/etc to rebuild the My.cnf file, the contents are as follows
# for advice The change settings see# http://dev.mysql.com/doc/refman/5.6/en/ server-configuration-defaults.html[mysqld]# Remove Leading # and set to the amount of RAM for the most important data# CAC He in MySQL. Start at 70% of all RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128m# Remove Leading # to turn on a V ery important data Integrity option:logging# changes to the binary log between backups.# log_bin# These is commonly set, Remove the # and set as required.# Basedir = .... # datadir =/data/mysql/data# Port = ... # server_id = ... socket = ... # Remove leading # To set options mainly useful for reporting servers.# the server defaults is faster for TRANSACTI ONS and fast selects.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128m# Sort_buffe R_size = 2m# Read_rnd_buffer_size = 2M max_connection = 10000sql_mode = No_engine_substitution,strict_trans_tables #binar Y log log-bin = Mysql-binbinlog_format = MixEdexpire_logs_day = 30#slow query Log slow_query_log = 1slow_query_log_file =/var/log/mysql/slow.loglong_query_time = 3l Og-queries-not-using-indexeslog-slow-admin-statements
Now it's time to start MySQL.
Sudo/usr/local/mysql/bin/mysqld_safe--user=mysql &
CentOS7 cannot use service to control MySQL services, and source-installed MySQL does not provide systemd control scripts.
Then edit the/etc/rc.d/rc.local file and add the MySQL boot command.
/usr/local/mysql/bin/mysqld_safe--user=mysql &
Then add executable permissions to/etc/rc.d/rc.local
sudo chmod a+x/etc/rc.d/rc.local
9. Change the root password
/usr/loca/mysql/bin/mysql-urootuse MySQL; UPDATE user SET Password = password (' test2015 ') WHERE user = ' root ';
GRANT all privileges on * * to [email protected] '% ' identified by ' stcm2015 ';
FLUSH privileges;
At this point, the installation is basically complete, a MySQL can be used.
Compile and install the MySQL 5.6.23 on CentOS 7