The local Navicat cannot connect to the MySQL database of the Linux virtual machine

Log in to MySQL data in Linux: mysql -uroot -p

enter password

switch to mysql database

mysql>use mysql

Enter grant all privileges on *.* to root@"%" identified by "password";

mysql> grant all privileges on *.* to root@"%" identified by "563412";

This means that all permissions are given to the local ip, including remote access rights, and the % percent sign means that any ip is allowed to access the database.

and then enter

mysql> flush privileges;

reload, and exit

mysql>exit

Then, restart the database

service mysql restart Note: Some commands to restart services are service, some are systemctl, I don't know if the Linux version is different, or for different services, the commands are also different, pay attention to this

The firewall should also be turned off, service iptables stop or systemctl stop firewalld.service

Then you can

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326133083&siteId=291194637