1. System Requirements
Mount/dev/cdrom/mnt
Yum install-y Cmake,make,gcc,gcc-c++,bison, Ncurses,ncurses-devel
2. Create users and Groups
Groupadd MySQL
useradd-g MySQL MySQL
3. Create a Database installation directory
Mkdir/mysql/mysql/data/mysql/log
Chown-r Mysql:mysql/mysql
/mysql/data--Database directory
/mysql/log--error log and slow query log
4. Extracting source files and boost files
Cd/usr/local
TAR-ZXVF mysql-5.7.19.tar.gz
TAR-ZXVF boost_1_59_0.tar.gz
cd/usr/local/mysql-5.7.19
####################################################
5. Compile and build the makefile file
CMake. \
-dcmake_install_prefix=/usr/local/mysql \
-dmysql_datadir=/mysql/data \
-DDEFAULT_CHARSET=UTF8MB4 \
-DDEFAULT_COLLATION=UTF8MB4_GENERAL_CI \
-ddownload_boost=1 \
-DWITH_BOOST=/USR/LOCAL/BOOST_1_59_0 \
-DSYSCONFDIR=/ETC \
-dwith_innobase_storage_engine=1 \
-dwith_myisam_storage_engine=1 \
-dwith_embedded_server=1 \
-dwith_federated_storage_engine=1 \
-dwith_partition_storage_engine=1 \
-dwith_blackhole_storage_engine=1\
-denabled_local_infile=1 \
-denable_dtrace=0 \
-dwith_readline=1 \
-dwith_debug=0
######################################################
-dcmake_install_prefix=/usr/local/mysql//installation directory
-dmysql_datadir=/mysql/data//Database storage directory
-dwith_myisam_storage_engine=1//install MYISAM storage Engine
-dwith_innobase_storage_engine=1//install InnoDB storage Engine
-dwith_archive_storage_engine=1//install ARCHIVE storage Engine
-dwith_blackhole_storage_engine=1//install Blackhole storage Engine
-denabled_local_infile=1//Allow import of data from local
-DDEFAULT_CHARSET=UTF8MB4//using UTF8 characters
-DDEFAULT_COLLATION=UTF8MB4_GENERAL_CI//Check character
-dmysql_tcp_port=3306//mysql Listening Port
-dmysql_user=mysql//mysql User Name
-dsysconfdir=/etc//mysql Matching file
-dmysql_unix_addr=/tmp/mysqld.sock//unix Socket file path
-dwith_readline=1//shortcut key function
-dwith_ssl=yes//ssl
-dwith_partition_storage_engine=1//Install database partition
-dinstall_plugindir=/usr/local/mysql/plugin//plugin file and configuration path
-dwith_debug=0 Disable DEBUG (default is disabled)
6. Compiling and installing
Make
Make install
7. Configure boot-up entry
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
chmod +x/etc/init.d/mysql
Chkconfig--add MySQL
Chkconfig MySQL on
8. Configuration Files
Cat >/etc/my.cnf << EOF
[Client]
Port = 3306
Socket =/tmp/mysql.sock
Default-character-set = Utf8mb4
[Mysqld]
Port = 3306
Socket =/tmp/mysql.sock
Basedir =/usr/local/mysql
DataDir =/mysql/data
Pid-file =/mysql/data/mysql.pid
user = MySQL
#bind-address = 0.0.0.0
Server-id = 1
#init-connect = ' SET NAMES utf8mb4 '
Character-set-server = Utf8mb4
#skip-name-resolve
#skip-networking
Back_log = 300
max_connections = 1000
Max_connect_errors = 6000
Open_files_limit = 65535
Table_open_cache = 128
Max_allowed_packet = 4M
Binlog_cache_size = 1M
Max_heap_table_size = 8M
Tmp_table_size = 16M
Read_buffer_size = 2M
Read_rnd_buffer_size = 8M
Sort_buffer_size = 8M
Join_buffer_size = 8M
Key_buffer_size = 4M
Thread_cache_size = 8
Query_cache_type = 1
Query_cache_size = 8M
Query_cache_limit = 2M
#ft_min_word_len = 4
Log_bin = Mysql-bin
Binlog_format = Mixed
Expire_logs_days = 30
Log_error =/mysql/log/mysql-error.log
Slow_query_log = 1
Long_query_time = 1
Slow_query_log_file =/mysql/log/mysql-slow.log
Performance_schema = 0
Explicit_defaults_for_timestamp
#lower_case_table_names = 1
Skip-external-locking
Default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table = 1
Innodb_open_files = 500
Innodb_buffer_pool_size = 64M
Innodb_write_io_threads = 4
Innodb_read_io_threads = 4
innodb_thread_concurrency = 0
Innodb_purge_threads = 1
Innodb_flush_log_at_trx_commit = 2
Innodb_log_buffer_size = 2M
Innodb_log_file_size = 32M
Innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
Innodb_lock_wait_timeout = 120
Bulk_insert_buffer_size = 8M
#myisam_sort_buffer_size = 8M
#myisam_max_sort_file_size = 10G
#myisam_repair_threads = 1
Interactive_timeout = 28800
Wait_timeout = 28800
[Mysqldump]
Quick
Max_allowed_packet = 16M
[Myisamchk]
Key_buffer_size = 8M
Sort_buffer_size = 8M
Read_buffer = 4M
Write_buffer = 4M
Eof
9. Initializing a secure installation
/usr/local/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/usr/local/mysql--datadir=/mysql/data
Note: The previous version mysql_install_db was under Mysql_basedir/script, 5.7 was placed in the Mysql_install_db/bin directory and has been discarded
"-initialize" generates a random password (~/.mysql_secret), and "-initialize-insecure" does not generate a password
–datadir cannot have data file under target directory
10. Start the database
Service MySQL Start
11. Change the password
Update Mysql.user set Authentication_string=password (' root ') where user = ' root ';
Flush privileges;
12. Turn off the firewall and SELinux
Service Iptables Stop
Chkconfig iptables off
Vi/etc/selinux/config
Selinux=disabled
The installation process recorded a video of its own, there is a need to me!
This article is from the "ROIDBA" blog, make sure to keep this source http://roidba.blog.51cto.com/12318731/1955933
Source installation MySQL 5.7.19 database