Detailed tutorial on installing mysql 5.7 in centOS 7, centosmysql
Reference official documents: https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
First create a repo File
vim /etc/yum.repos.d/mysql-community.repo
Then write data according to the official documents:
For example, install mysql 5.7 On centOS 7.
[Mysql57-community] name = MySQL 5.7 Community Serverbaseurl = links // official documentation here is 1, set 0 to skip detection, without affecting installation. Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Mainly in baseurl
The mysql-5.7-community is the mysql version number and the version 5.6 is the mysql-5.6-community;
The next 7 is the centOS version. For example, centOS 6.5 should be 6;
Then you can start installing mysql by referring to the official documentation:
sudo yum install mysql-community-server
Start mysql
sudo service mysqld start
View mysql running status
sudo service mysqld status
Open the/var/log/mysqld. log File and find the password automatically set for mysql. This password is complicated!
Run mysql-uroot-p, press enter, enter the password you just saw, and press Enter;
Change the password (because of the password security policy of mysql5.7, first use a password with high complexity, and then modify it ):
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'
Then you can perform mysql operations!
Supplement: Password Security Policy (for Development Environment)
mysql> SHOW VARIABLES LIKE 'validate_password%';
Parameter description:
1). validate_password_dictionary_file specifies the file path for password verification;
2). validate_password_length: Minimum Password Length
3). The validate_password_mixed_case_count password must contain at least the number of lower-case letters and the number of upper-case letters;
4). The validate_password_number_count password must contain at least the number of numbers.
5). validate_password_policy password strength check level, corresponding level: 0/LOW, 1/MEDIUM, 2/STRONG, default is 1
6). The number of special characters in the validate_password_special_char_count password. The default value is 1.
Note:
0/LOW: Check the length only;
1/MEDIUM: Check the length, number, case, and special characters;
2/STRONG: Check the length, number, case, and special character dictionary file.
6). The validate_password_special_char_count password must contain at least the number of special characters
For example, I want to change the password to "1234 ";
Run
SET GLOBAL validate_password_length=4;SET GLOBAL validate_password_mixed_case_count=0; SET GLOBAL validate_password_policy=LOW;SET GLOBAL validate_password_special_char_count=0;
Then
ALTER USER 'root'@'localhost' IDENTIFIED BY '1234';
The above is a detailed tutorial on installing mysql 5.7 On centOS 7. I hope it will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!