MySQL website yum installation tutorial, Address: https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/#repo-qg-yum-fresh-install
One, MySQL download installation
Download the MySQL rpm file first: https://dev.mysql.com/downloads/repo/yum/
Uploading to the/home directory using the upload command, such as the RZ command (yum install-y lrzsz)
Add a MySQL repository (-UVH followed by the rpm file you downloaded)
sudo rpm-uvh mysql57-community-release-el7-11.noarch.rpm
Install MySQL
sudo yum install-y mysql-community-server
Start the MySQL service
Or
sudo systemctl start Mysqld.service
Second , the password configuration
The new version of MySQL creates an initial password for the root user and needs to be changed.
View the default password
sudo grep ' temporary password '/var/log/mysqld.log
Use this initial password to log in to MySQL
Mysql-uroot-peejvy2mlgs+e
Fixed password strength Check rule (used for test environment), the high version of MySQL will restrict the creation of simple password when changing password, if it is only for testing, it can modify his password detection policy:
Modify: Password Minimum length policy
MySQL>set global validate_password_length=0;
Modified: Password strength check level policy, 0/low, 1/medium, 2/strong
MySQL>set global validate_password_policy=0;
Change Password
MySQL>setfor'root'@'localhost' = password ('root123');
Second , other configuration
Open MySQL root user remote Connection service (% number is remote connection, identified by followed by password)
MySQL>GRANTallprivilegeson*. * to ' Root '@ '%' by'root123' withGRANTOPTION;
Refresh
MySQL>privileges;
Turn on the MySQL port service
/sbin/iptables-i input-p TCP--dport 3306-J Acceptservice Network Restart
CentOS install MySQL and configure initial password