Install and configure MySQL in CentOS 7.2, centosmysql
1. Related configurations are as follows:
Operating System: CentOS 7.2
MySQL version: 5.7.x
Ii. Download and install
2.1 Download rpm package
Select the appropriate version: system version and package version. You can view the system version through uname-:
wget http://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm
2.2 download and install the software source
sudo yum localinstall platform-and-version-specific-package-name.rpm
Platform-and-version-specific-package-name.rpm this is the match with the above, for the above example is also mysql57-community-release-el7-9.noarch.rpm.
Note:This operation adds MySQL Yum repository to the repository list of the system, and downloads the GnuPG key to check the integrity of the software package.
You can check whether the source is added to the system:
shell> yum repolist all | grep mysql
The output result of the above command is used to determine.
2.3 install MySQL
sudo yum install mysql-community-server
2.4 start MySQL Server
sudo systemctl start mysqld
You can view the server running status
systemctl status mysqld
To enable mysql to start up, run the following command:systemctl enable mysqld.service
Note:Is mysqld, there is a d.
2.5 initialization settings
mysql_secure_installation
This command requires you to set some password and other information.
All the steps are completed here. If you have any questions, refer to the following.
Iii. Problems
Q1. Login Password required for initialization:
Cause: a random temporary password will be generated during installation of MySQL 5.7 or above, which exists here:/var/log/mysqld.log
To obtain the password:
sudo grep 'temporary password' /var/log/mysqld.log
Q2. Password Policy error
That is why the six-digit password cannot be set.
Cause: MySQL has a password verification plug-in to prevent the password setting from being too simple.
You can set a complex password first, and then change the password requirements to a simple one. The complex password requirements are as follows:
1. special characters
2. uppercase and lowercase letters
3. Number
4. 8 characters in length
Here is a demo password :! Aa112233.
After logging on with a new password, check 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 password restrictions. You can change them to the following:
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;
Then you can set a 6-digit password.
Summary
The above is all the content of this article. I hope the content of this article will be helpful for your study or work. If you have any questions, please leave a message.