Install mysql5.7.17 on centos7.2
MariaDB is used in the default source of yum Versions later than CentOS 7 to replace the original MySQL version. Therefore, the installation method has changed a little bit:
Download the mysql Source
Wgethttp: // dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
Install yum Library
Yumlocalinstall-ymysql57-community-release-el7-7.noarch.rpm
Install MySQL
Yuminstall-ymysql-community-server
Start MySQL Service
Systemctlstartmysqld. service
MySQL5.7 enhances the security of root users. Therefore, a random password is initialized after the first installation. The following describes how to view the initial random password.
Grep 'temporarypassword'/var/log/mysqld. log
The result is as follows:
After you log on with the initial Random Password, MySQL will force you to change the password. Otherwise, the password cannot be used normally. (The password must contain lower-case, upper-case letters, and special characters. Of course, other methods are not limited, ), The modification method is as follows:
SETPASSWORD = PASSWORD ('yourpassword'); alteruser'root' @ 'localhost' PASSWORDEXPIRENEVER; flushprivileges;
Then, log out with the new password.
Remote connection authorization:
GRANTALLPRIVILEGESON *. * TO 'root' @ '%' IDENTIFIEDBY 'yourpassword' WITHGRANTOPTION;
Port opened (3306 by default ):
Firewall-cmd -- add-port = 3306/tcp