1. Go to the mysql official website to get the download link of mysql
https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
2. Download the mysql rpm package
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
3.rpm installation
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
4. After the rpm installation is complete, yum installation
yum install mysql57-community-release-el7-11.noarch.rpm
5. View the initial password after the installation is complete
grep temporary password /var/log/mysqld.log
6. Test login
mysql -uroot -p
7. If you can't do anything after logging in or log in with a 1045 error code, try to change the password and log in again
$ sudo systemctl stop mysqld.service
mysql open remote connection
1. Log in to the database
mysql -uroot -p
2. Open the remote connection
root username
% everyone can access
password password
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
3. Restart mysql
service mysqld restart
If you still cannot connect to mysql remotely after performing the above steps, try to open port 3306 of the firewall or close the firewall