CentOS version 7.2, MySQL version 5.7
1. Download MySQL installation source
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
2. Install MySQL source
RPM-IVH mysql57-community-release-el7-11.noarch.rpm
3. Install MySQL
Yum Install mysql-community-server-y
4. Start MySQL
Systemctl start Mysqld.service or service mysqld restart
5. Change the password
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 grep command using tutorial
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 = PASSWORD (' Your new PASSWORD '); ALTER USER ' root ' @ ' localhost ' PASSWORD EXPIRE never;flush privileges;
Then you can sign in with your new password after exiting.
6. Remote Connection Authorization
MySQL is based on the MySQL database in the user table inside the host field to do IP authentication, modified to ' @ ' means no limit connection, you can also specify an IP address.
Use MySQL;
Update set User host= ' @ ' where user= ' root ';
7. Open 3306 Port
The firewall needs to be restarted after opening the port, Firewalld use reference
Firewall-cmd --zone=public --add-port=3306/tcp--permanent
Firewall-cmd--reload
Above reference http://www.cnblogs.com/longrui/p/6071581.html
CentOS installation configuration MySQL database