Reference Official Document: 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 according to the official documentation:
For example, installing MySQL 5.7 in CentOS 7
[Mysql57-Community]name 5.7 Community serverbaseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/ enabled=1Gpgcheck= 0//Official document Here is 1, setting 0 can skip detection without affecting the installation. Gpgkey=file:///Etc/pki/rpm-gpg/rpm-gpg-key-mysql
Mainly in the BaseURL.
Mysql-5.7-community is the MySQL version number, using the 5.6 version is mysql-5.6-community;
The next 7 is the CentOS version, for example CentOS 6.5 should be 6;
You can then start installing MySQL by referencing the official documentation:
sudo Yum Install Mysql-community-server
Start MySQL
sudo service mysqld start
View MySQL Run status
sudo service mysqld status
Now open the /var/log/mysqld.log file and find the password that is automatically set for MySQL, this password is more complicated!
Then run mysql-uroot-p Enter after entering the password you just saw, carriage return;
Change Password (due to mysql5.7 password security policy, first use a higher complexity password, and then modify):
' Root '@'localhost'mynewpass4! '
After that, you can do all of the MySQL operations!
Supplemental: About password security policies (for development environments)
' validate_password% ';
Parameter explanation:
1). validate_password_dictionary_file Specifies the file path of the password authentication;
2). validate_password_length Password Minimum length
3). Validate_password_mixed_case_count password must contain at least the number of lowercase letters and the number of capital letters;
4). Validate_password_number_count password must contain at least the number of digits
5). Validate_password_policy Password strength check level, corresponding level: 0/low, 1/medium, 2/strong, default is 1
6). Validate_password_special_char_count the number of special characters in the password, the default is 1
Attention:
0/low: check length only;
1/medium: Check length, number, case, special characters;
2/strong: Check the length, number, case, and special character dictionary files.
6). 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";
Execute first
SET GLOBAL validate_password_length=4; SET Global Validate_password_mixed_case_count=0SET Global Validate_password_ Policy=low; SET GLOBAL validate_password_special_char_count=0;
And then
ALTER USER ' Root '@'localhost' by '1234 ';
Blog Novice, if there are errors also look correct!
Install MySQL 5.7 in CentOS 7.