First, sufo ufw status checks whether the firewall is turned on. If the status is inactive, it means that the firewall is not turned on.
Then enter netstat -an|grep 3306 to check the port startup and occupancy. You can see that the binding is 127.0.0.1. We need to change this to 0.0.0.0. Will talk about it below.
First you must modify the mysql access permissions, enter mysql -u root -p, press Enter, and then enter the password 123456 to enter the mysql command line.
Enter grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; Specify that all clients can use the root account to access mysql.
Related recommendations: "Navicat for mysql graphic tutorial"
Enter flush privileges; refresh permission settings.
Enter exit; to exit the mysql command line.
Enter cd /etc/mysql/mysql.conf.d to enter the mysql configuration directory.
Enter vim mysqld.cnf to modify the mysql configuration file.
Find bind-address and modify 127.0.0.1 to 0.0.0.0.
Enter /etc/init.d/mysql restart to restart mysql.
Use navicat to connect to mysql again, and finally you can connect.
The above is the detailed content of Detailed solution for navicat unable to connect to ubuntu. For more information, please follow other related articles on the PHP Chinese website!