Refer to official Documentation: 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 to the official document:
For example, install MySQL 5.7 in CentOS 7
[Mysql57-community]
Name=mysql 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
Enabled=1
gpgcheck=0//Official documentation This is 1, Setup 0 can skip detection and does not affect 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 back 7 is the CentOS version, for example CentOS 6.5 should be 6;
You can then start installing MySQL to refer to 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/var/log/mysqld.log file, find the password set automatically for MySQL, this password is more complicated!
Then run mysql-uroot-p Enter the password you just saw, carriage return;
Modify password (because of mysql5.7 password security policy, first use a more complex password, then make changes):
ALTER USER ' root ' @ ' localhost ' identified by ' mynewpass4! '
Then you can do all the operation of MySQL!
Supplemental: About password security policies (for development environments)
Mysql> show VARIABLES like ' validate_password% ';
Parameter explanation:
1). validate_password_dictionary_file Specifies the file path for password authentication;
2). validate_password_length Password Minimum length
3. Validate_password_mixed_case_count password to contain at least the number of lowercase letters and the number of uppercase letters;
4. Validate_password_number_count password must contain at least the number of digits
5). Validate_password_policy Password intensity check grade, corresponding grade is: 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: only check the length;
1/medium: Check length, number, case, special characters;
2/strong: Check length, number, case, special character dictionary file.
6. Validate_password_special_char_count password must contain at least the special number of characters
For example, I would like to change the password to "1234";
Execute first
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;
And then
ALTER USER ' root ' @ ' localhost ' identified by ' 1234 ';
The above is a small set for you to introduce in the CentOS 7 installed MySQL 5.7 Detailed tutorial, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!