1. mysql official website: https://downloads.mysql.com/archives/community/ download the installation package
2. Upload to the server
3. Check whether mysql has been installed on Linux, and uninstall it if it is available. Generally, centos7 installs mariadb by default, and uninstall it here.
View: rpm -qa | grep mariadb
Uninstall: rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
4. Installation dependencies
Execute the following commands in sequence:
1.yum install libaio
2.yum install perl
3.yum install net-tools
5. Unzip the file
tar -xvf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
6. Run the following commands in order to install
1.rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm
2.rpm -ivh mysql-community-libs-5.7.28-1.el7.x86_64.rpm
3.rpm -ivh mysql-community-client-5.7.28-1.el7.x86_64.rpm
4.rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm
7. Check whether the installation is successful
service mysqld status
The red part above indicates that there is no start, execute the command to start
service mysqld status
8. About password
Execute command: grep password /var/log/mysqld.log
The red part above is the default password.
Then log in to mysql
mysql -uroot -p
Enter the above password, the login is successful
Run use mysql; found an error
It turns out that you need to reset the password, then execute the reset password command: set password = password ("123456");
I wiped it and reported the error again. It probably means that the password is insecure. Let's get a bit more complicated: SET PASSWORD = PASSWORD ('longyao. @ 123ly');
Still report an error, and then find information to solve, find a blog: https://www.cnblogs.com/ivictor/p/5142809.html , so follow the operation, get it done
set global validate_password_policy=0;
set global validate_password_length=1;
Execute again: set password = password ("123456");
After logging out, you can log in with the new password
9. Configure remote access
Execute command: GRANT ALL PRIVILEGES ON *. * TO 'root' @ '%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Because my machine has a firewall, so I need to add a port
firewall-cmd --permanent --zone=public --add-port=3306/tcp
Restart: systemctl reload firewalld
Connect via navicat