After CentOS 7, the default source for Yum uses mariadb instead of the original MySQL, so there have been some changes to the installation method:
Download source for MySQL
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
Installing the Yum Library
Yum Localinstall-y mysql57-community-release-el7-7.noarch.rpm
Install MySQL
Yum Install-y mysql-community-server
Start the MySQL service
Systemctl Start Mysqld.service
MySQL5.7 strengthens the root user's security, so a random password is initialized after the first installation, the following is how to view the initial random password
grep ' temporary password '/var/log/mysqld.log
The results are as follows:
After logging in with the initial random password, MySQL will be forced to change the password, otherwise it would not work, (the password must contain lowercase, uppercase and special characters, of course, there are other methods not subject to this limitation, again do not describe more), modify the method as follows:
SET = PASSWORD ('your new PASSWORD'); ALTER USER ' Root '@'localhost'privileges;
Then you can sign in with your new password after exiting.
Remote Connection Authorization:
GRANT All Privileges on *. * to ' Root '@ '%'by'your password' with GRANT OPTION;
Open port (default 3306):
Firewall-cmd--add-port=3306/tcp
CentOS 7.2 Yum Way to install MySQL 5.7