The mysql-community-server is installed through the official Yum source of MySQL, which is the MySQL 8.0 version.
wget
rpm -ivh mysql80-community-release-el7-1.noarch.rpm
yum
install
mysql-community-server
service mysqld start
After the first boot there will be an initialization process that will generate a random password for the root account.
To enhance security, MySQL5.7 randomly generated a password for the root user, in Error_log, about the location of Error_log, if the RPM package is installed, the default is/var/log/mysqld.log.
You can find the password by grep ' temporary password '/var/log/mysqld.log:
After landing, the normal operation will be limited, prompting you must change the password before you can operate.
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
Follow the prompts to change the password:
mysql> SET PASSWORD = PASSWORD(
‘123456‘
);
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> SET PASSWORD = PASSWORD(
"root"
);
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
However, the password set is not allowed according to the current password policy.
After reviewing the official documentation, we found the following three password policies:
| Policy |
Tests performed |
0OrLOW |
Length |
1OrMEDIUM |
Length; Numeric, lowercase/uppercase, and special characters |
2OrSTRONG |
Length; Numeric, lowercase/uppercase, and special characters; Dictionary file |
The current password policy defaults to 1, which is MEDIUM, but when you use:show VARIABLES like "%password%"; 来查看当前策略时,发现还是会让你先修改密码(这个比较坑)
Next Modify the security policy (follow the actual environment needs, the production environment simple password may be unsafe):
setglobal validate_password_policy = 0;
The above statement is for everyone to use, as if there is nothing wrong with me, but it's not good to be here/cry
More depressed
Google, Baidu for a long time also did not result. What's the whole?
Let's do it, change the password first, set a password that contains uppercase and lowercase letters, numbers, and special symbols, OK, fix it, and then look at the security policy:
show VARIABLES like "%password%";
Ghanima, how the underscore becomes "." ???
Okay, now you can modify the security policy as needed:
Set global validate_password.policy = 0;
Validate_password_number_count Specifies the length of the data in the password ,
Validate_password_special_char_count Specifies the length of the special characters in the password ,
Validate_password_mixed_case_count Specifies the length of the size letter in the password .
Some official notes: https://dev.mysql.com/doc/refman/8.0/en/validate-password.html
Questions about MySQL initialization and security policy cannot be modified