1. Download the rpm package mysql
[root@izwz91qnvovd6suufon1ccz ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
2. Install the rpm package
[root@izwz91qnvovd6suufon1ccz ~]# yum localinstall -y mysql57-community-release-el7-7.noarch.rpm
3. Install mysql 5.7
[root@izwz91qnvovd6suufon1ccz ~]# yum install -y mysql-community-server
4. Start mysql 5.7
[root@izwz91qnvovd6suufon1ccz ~]# systemctl start mysqld.service
5. Check the status of the database:
service mysql status
6. MySQL has a default password after 5.7 installation is complete, view the default password:
[root@izwz91qnvovd6suufon1ccz ~]# grep 'temporary password' /var/log/mysqld.log
2019-12-09T04:21:12.283622Z 1 [Note] A temporary password is generated for root@localhost: b;M%;tBXw5E8
7. Modify the default password:
[root@izwz91qnvovd6suufon1ccz ~]# mysql -u root -p Enter password: - Using the above password to access mysql mysql> set password = password('yourpassword');
Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> alter user 'root'@'localhost' password expire never; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> quit; - exit before using password
8. Fu Remote access:
mysql> grant all privileges on *.* to 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.00 sec)
9. facie Firewall:
[root@izwz91qnvovd6suufon1ccz ~]# firewall-cmd --list-all
FirewallD is not running
10. I am not here to run a firewall can be used directly navicat remote access, the default port 3306
11. About firewall:
1. Check the firewall firewall-cmd --list-all 2. Add port 3306 firewall-cmd --permanent --add-port=3306/tcp 3. Restart the firewall service firewalld restart 4. Check whether the 3306 Open firewall-cmd --query-port=3306/tcp ----------------------------------------------------------- 5. Check firewall status systemctl status firewalld.service 6. Turn off the firewall systemctl stop firewalld.service 7. Start Firewall systemctl start firewalld 8. Power disable the firewall systemctl disable firewalld 9. Power Enable Firewall systemctl enable firewalld