First, the related configuration is as follows
Operating system: CentOS 7.2
MySQL version: 5.7.x
Second, download and install
2.1 Download RPM Package
Select the appropriate version: System version and package version. The system version can be viewed through uname-a:
wget http://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm
2.2 Download installation software source
sudo yum localinstall platform-and-version-specific-package-name.rpm
PLATFORM-AND-VERSION-SPECIFIC-PACKAGE-NAME.RPM This is to match the above, for the example is mysql57-community-release-el7-9.noarch.rpm .
Description: This operation will be the MySQL Yum repository added to the System Repository list, will also download GnuPG key to check the integrity of the software package.
You can see if the system added the source:
shell> Yum Repolist All | grep MySQL
Judged by the output of the above command.
2.3 Installing MySQL
sudo yum install Mysql-community-server
2.4 Start MySQL Server
sudo systemctl start mysqld
can view server health
For MySQL to boot, you can set this command to:systemctl enable mysqld.service
attention is mysqld, there is a d.
2.5 Initialization settings
Mysql_secure_installation
This command will ask you to set up some password and other information.
Here all the steps are gone, if there are problems can refer to the following.
Iii. issues
Q1. Initialization requires login password:
Reason: MySQL 5.7 and above in the installation will generate a random temporary password, exist here: /var/log/mysqld.log
, you can use the following methods to obtain the password:
sudo grep ' temporary password '/var/log/mysqld.log
Q2. Set password appears Password policy problem
That is why you cannot set a 6-bit password problem.
Reason: MySQL has a password-verified plug-in to prevent the password settings from being too simple.
You can set up a complex password, then change the password requirements and then change to simple, this complex password requirements are:
1. Special characters
2. Uppercase and lowercase letters
3. Digital
4. Length 8 bits
Here give a demo password:! Aa112233.
After you log in with a new password, view the password-related variables:
Show VARIABLES like ' validate_password% ';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_dictionary_file | |
Validate_password_length | 8 | |
validate_password_mixed_case_count | 1 |
| | validate_ Password_number_count | 1 |
| validate_password_policy | MEDIUM |
| Validate_password_special_char_count | 1 |
+--------------------------------------+--------+
The above variables are the restrictions on the password, which can be changed:
mysql> SET GLOBAL validate_password_policy = low;
mysql> SET GLOBAL validate_password_length = 6;
mysql> SET GLOBAL validate_password_number_count = 0;
mysql> SET GLOBAL validate_password_mixed_case_count = 0;
mysql> SET GLOBAL validate_password_special_char_count = 0;
You can then set a 6-bit password.
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can help, if there is doubt you can message exchange.