Upload files and unzip them
[Email protected] ~]# cd/usr/local/ls mysql*mysql-5.7. 9-LINUX-GLIBC2. 5-x86_64. Tar tar zxvf mysql-5.7. 9-LINUX-GLIBC2. 5-x86_64. tar. gz
Create a soft connection after the decompression is complete
[Email protected] local]#LN-S mysql-5.7.9-LINUX-GLIBC2.5-x86_64 mysql[[email protected] local]# CD Mysql[[email protected] mysql]# lltotal thedrwxr-xr-x2 7161Wheel4096Oct A -bin-rw-r--r--1 7161Wheel17987Oct A -COPYINGDRWXR-xr-x2 7161Wheel4096Oct A -DOCSDRWXR-xr-x3 7161Wheel4096Oct A -include-rw-r--r--1 7161Wheel108028Oct A -install-BINARYDRWXR-xr-x5 7161Wheel4096Oct A -LIBDRWXR-xr-x4 7161Wheel4096Oct A - Mans-rw-r--r--1 7161Wheel2478Oct A -READMEDRWXR-xr-x - 7161Wheel4096Oct A -SHAREDRWXR-xr-x2 7161Wheel4096Oct A -Support-files
Create users and Groups
-r-g MySQL MySQL
User and group modifications for files below the MySQL path
chown -chgrp -R MySQL.
Create a data file and log file path
mkdir /mydata/mydata/data/mydata/chown -R mysql:mysql/mydata
Create a MY.CNF file
[Email protected] mysql]#VI/etc/My.cnf[client]port=3306Socket=/var/lib/mysql/mysql.sock[mysqld]server_id=TenPort=3306User=Mysqlcharacter-set-server =Utf8mb4default_storage_engine=Innodblog_timestamps=Systemsocket=/var/lib/mysql/Mysql.sockbasedir=/usr/local/Mysqldatadir=/mydata/Datapid-file=/mydata/data/mysql.pidmax_connections= +max_connect_errors= +Table_open_cache=1024x768Max_allowed_packet=128mopen_files_limit=65535#####====================================[innodb]==============================innodb_buffer_pool_size=1024minnodb_file_per_table=1innodb_write_io_threads=4innodb_read_io_threads=4innodb_purge_threads=2Innodb_flush_log_at_trx_commit=1innodb_log_file_size=512minnodb_log_files_in_group=2innodb_log_buffer_size=16minnodb_max_dirty_pages_pct= theInnodb_lock_wait_timeout= -Innodb_data_file_path=ibdata1:1024m:autoextend#####====================================[log]==============================Log_error=/mydata/log/mysql-Error.log Slow_query_log=1Long_query_time=1Slow_query_log_file=/mydata/log/mysql-Slow.logsql_mode=no_engine_substitution,strict_trans_tables
Initializing the database
The method to initialize before 5.7.6 is: bin/mysql_install_db--user=mysql
Version initialization database after 5.7.6 is no longer used mysql_install_db
[Email protected] mysql]# bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/mydata/data-- innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp
[Email protected] mysql]# Bin/mysql_ssl_rsa_setup--datadir=/mydata/data
If the MY.CNF Log_error is configured, the initial password is in the Log_error file, otherwise it will be printed.
Change the user of the file under the/usr/local/mysql path after the initial completion
Chown -R root.
Configuring Startup files
CP support-files/mysql.server/etc/init.d/--add mysqlchkconfig mysql onservice mysql start
Configuring Environment variables
vi /etc/profilemysql_home=/usr/local/mysqlpath= $PATH: $mysql _home//etc/ Profile
Change Password
The field that stores the password in 5.7 is no longer a password, it becomes a authentication_string
Update Mysql.user set Authentication_string=password (' root ') where user= ' root ';
If you change the root password, you will need to reset the root password if you log in to the MySQL system for the first time using the root user.
SET password=password (' root ');
Flush privileges;
MySQL binary installation