1. Before installing MySQL, you need to ensure that the system has Libaio dependencies, using the following command:
2. Go to the CentOS terminal interface and download the mysql5.7 64-bit installation file using the wget command:
Wget-c https://cdn.mysql.com//downloads/mysql-5.7/ Mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
Download Complete:
3. Extract the MySQL installation package to the specified directory with the following command:
TAR-ZXVF mysql-5.7. -LINUX-GLIBC2. 5
4. Enter the/usr/local directory:
Cd/usr/local
5. Create a soft link for the MySQL installation directory:
Ln-s mysql-5.7. -LINUX-GLIBC2. 5-x86_64 MySQL
6. Add MySQL user group and MySQL user to CentOS (the-s/bin/false parameter specifies that the MySQL user has only ownership and no login privileges):
-r-g mysql-s/bin/false MySQL
7. Go to the directory where the MySQL software is installed and command the following:
Cd/usr/local/mysql
8. Modify the current directory owner for the new MySQL user, the command is as follows:
Chown-r Mysql:mysql./
9. Install MySQL with the following command:
./bin/mysqld--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--initialize
When the installation is complete, the following information appears, recording the randomly generated login password:
10. Start the MySQL service with the following command:
./support-files/mysql.server Start
11. Place the MySQL process into the system process with the following command:
CP Support-files/mysql.server/etc/init.d/mysqld
12. Restart the MySQL service with the following command:
Service mysqld Restart
13. Log in to the MySQL database using a random password, with the following command:
Mysql-u root-p
Wait for the system prompt, enter a random password, you can log in
14. Enter the MySQL operation line and set a new password for the root user (small set to Rootroot):
' Root '@'localhost'rootroot';
15. Set the Allow remote connection to the database with the following command:
set user. host='%'where user. user='root';
16. Refresh the permissions with the following command:
Flush privileges;
The CentOS system is installed through the tar.gz package Mysql5.7