This article is only for recording, if I can help you is also a great honor!

Install MySQL8.0

Download and install MySQL official Yum Repository

[root@Rameo ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
Copy the code

You can install Yum Repository directly by using the command above.

[root@Rameo ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
Copy the code

The MySQL server starts to be installed

[root@Rameo ~]# yum -y install mysql-community-server
Copy the code

Start the MySQL service

[root@Rameo ~]# systemctl start mysqld.service
Copy the code

Check the running status of MySQL, as shown in the figure:

[root@Rameo ~]# systemctl status mysqld.service
Copy the code

If the following information is displayed, the startup is successful

Reset MySQL8.0 password

1. Modify the login Settings of MySQL

[root@Rameo ~]# vim /etc/my.cnf
Copy the code

Add the configuration shown in the figure

[mysqld]
skip-grant-tables
Copy the code

Save and restart MySQL service

[root@Rameo ~]# systemctl restart mysqld.service
Copy the code

2. Change the password of MySQL

Enter the mysql

[root@Rameo ~]# mysql -u root
Copy the code

Switch to the mysql database

mysql> use mysql;
Copy the code

Empty password

mysql> update user set authentication_string=' ' where user='root';
Copy the code

Exit the mysql

mysql> exit
Copy the code

Vim /etc/my.cnf/vim /etc/my.cnf/vim /etc/my.cnf/vim /etc/my.cnf/vim /etc/my.cnf/vim /etc/my.cnf/vim /etc/my.cnf/vim /etc/my.cnf

Set the password

mysql> ALTER USER 'root'@The '%' IDENTIFIED BY 'New password' PASSWORD EXPIRE NEVER;
Copy the code
mysql> ALTER USER 'root'@The '%' IDENTIFIED WITH mysql_native_password BY 'New password';
Copy the code

Put changes into effect

mysql> FLUSH PRIVILEGES;
Copy the code