First, download MySQL
Mkdir/home/install #创建install目录
Download mysql5.7 in the/home/install directory
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
Download complete
Second, extract to/USR/LOCAL/MSYQL
Decompression TAR-ZXVF mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
Move to/usr/local/mysql
MV Mysql-5.7.23-linux-glibc2.12-x86_64/usr/local/mysql
Third, create the relevant directory
1. Create a storage directory
Mkdir/usr/local/mysql/data
Iv. new user, user group, user directory
1. Create a user group
Groupadd MySQL
2. Create a non-logged-in user and add a directory
Useradd-r-s/sbin/nologin-g MySQL mysql-d/usr/local/mysql/
3. Changing directory Properties
Chown-r Mysql/usr/local/mysql
Chgrp-r Mysql/usr/local/mysql
Five, configuration parameters
1. Initialize, record the initial password fysvgm0.ja6e
/usr/local/mysql/bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
2. Turn on SSL
/usr/local/mysql/bin/mysql_ssl_rsa_setup--datadir=/usr/local/mysql/data
3. Modify/ETC/MY.CNF
Vim/etc/my.cnf
Delete the contents of the/etc/my.cnf change to
4. Modify the Boot configuration file
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
Vim/etc/init.d/mysql
Join
Basedir=/usr/local/mysql
Datadir=/usr/local/mysql/data
5. Establishing a MySQL shortcut command connection
Ln-s/usr/local/bin/mysql/usr/bin
Six, start, connect, test
1. Start the command
Service mysqld Start
Or
Service mysqld Start
Or
/usr/local/mysql/support-files/mysql.server start
2. Connect
Mysql-uroot-p
3. Reset Password
Set password = password (' 123456 ');
4. Set root account permissions to support remote connections
Mysql> Grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ';
Flush privileges;
Vii. Other Configurations
1. Firewall Problem Reference: https://www.cnblogs.com/zwcry/p/9457435.html
2. Set boot boot (can also use Sytemctl to do the boot service, Baidu)
chmod 775/etc/init.d/mysql
Chkconfig--add MySQL
Chkconfig--level 345 MySQL on
Linux CentOS7 Installation Mysql5.7