If you can connect your centos to the Internet, download and install Yum Repository

Download Yum Repository.

[root@localhost admin]#  curl -O https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
Copy the code

Install Yum Repository.

[root@localhost admin]#  yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
Copy the code

3. View available Repos.

[root@localhost admin]#   yum repolist enabled|grep "mysql.*-community.*"
Copy the code

4. Install mysql-server.

[root@localhost admin]#  yum -y install mysql-community-server
Copy the code

2. Configure and start the service

1. Start the service

[root@localhost admin]#  systemctl start mysqld
Copy the code

2. Find the initial password.

[root@localhost admin]#  grep 'temporary password' /var/log/mysqld.log
Copy the code

3. Log in and change the password.

[root@localhost admin]#  mysql -u root -p
Copy the code

4, set the password (here my password set to admin)

mysql> set password=password('admin');
Copy the code

The ERROR is caused by a weak password. Provide a strong password.

mysql>set password =password('Centos.mysql./8');
Copy the code

3. Navicat connection test 12. Solution Log in to mysql and query the allowed address of the user, as shown in The figure

use mysql;
select user,host from user;
Copy the code

3. Modify user rights

update user set host = The '%' where user = 'root';

Copy the code

4. Check whether the user rights are modified successfully

select user,host from user where user="root";
Copy the code

The IP address can be accessed from any IP address

Update database:

flush privileges; 
Copy the code

Then exit the mysql command line and connect to Navicat