CentOS7 Bring mariadb, delete it
Rpm-qa | grep mariadbrpm-e mariadb-libs-5.5.37-1.el7_0.x86_64
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/mysql sudo chown-r mysql. sudo chgrp-r MySQL. sudo scripts/mysql_install_db--user=mysqlsudo chown-r root. sudo chown-r mysql data
At this point, MySQL can start running.
9. Start MySQL
Rebuild the My.cnf file under/etc with the following content
# 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 # cache in MySQL. Start at 70% of all RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove Leading # to turn on a very important data integrity Option:logging # Chang ES 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 transactions and fast selects. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M Max_connection = 10000 Sql_mode = NO_ engine_substitution,strict_trans_tABLES #binary Log log-bin = Mysql-bin Binlog_format = Mixed Expire_logs_day = #slow query log slow_query_l og = 1 slow_query_log_file =/var/log/mysql/slow.log long_query_time = 3 log-queries-not-using-indexes log-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-uroot use mysql; UPDATE user SET Password = password (' test2015 ') WHERE user = ' root '; GRANT all privileges on * * to [email protected] '% ' identified by ' passwd2015 '; 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