1. Download the binary version of the installation package. Sohu Open Source Mirror station: http://mirrors.sohu.com/mysql/MySQL-5.7/, looking for mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
2, I installed in the/var/local directory
2.1 Downloads of packages extracted to/var/local
[[email protected] Download]# tar-zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz-c/usr/local/
2.2 Go to/var/local, rename folder
[[email protected] Download]# cd/usr/local/[[email protected] local]# mv MySQL-5.7.18-linux-glibc2.5-x86_64 mysql5.7.18
2.3 Create groups and users, and set users as system users
-r-g mysql-s/bin/false MySQL
2.4 Initializing the database
[Email protected] mysql5.7.18]# bin/mysqld--initialize--user=mysql--basedir=/var/local/mysql5.7.18--datadir=/var /local/mysql5.7.18/data
2.5 Configure/ETC/MY.CNF, no words create a
[Email protected] mysql5.7.18]# VI/ETC/MY.CNF
=/var/local/mysql5.7.18=/var/local/mysql5.7.18/datalog-error =/var/log/mysql-error.log
2.6 Starting the Service
[Email protected] mysql5.7.18]# Bin/mysqld_safe--user=mysql &
3. Connect to MySQL
3.1 Open a new terminal, CD to your MySQL directory, mine is/usr/local/mysql5.7.18. Enter the password just written down, mine is 5cj6) koo4u (s
[Email protected] mysql5.7.18]# bin/mysql-u root-p
Do not know why, here must enter the mysql5.7.18 directory, using the BIN/MYSQLS command, cannot enter the bin directory using the mysqld command
3.2 Update Root password. The system requires the password to be updated no matter what the command is written in
Mysql> ALTER USER ' root ' @ ' localhost ' identified by ' 123456 ';
3.3 Under Linux for security, the default is not to allow machines outside the MySQL server to access the MySQL database service, so you need to re-authorize the root account. To facilitate remote access to MySQL server by other machines, the MySQL command is as follows:
Grant all privileges on * * to [email protected] '% ' identified by ' 123456 ';
3.4 Open Port 3306, open a new terminal
[Email protected]/]$ firewall-cmd--zone= public --add-port=3306/tcp--/]$ firewall-cmd--reload
OK, the connection can be tested on other machines.
CentOs 7 Installation mysql5.7.18 (two-in-a-plate)