mysql 61

I want to link the mysql of the virtual machine on my local machine. I use the workbench under mac, but I can't connect. The error message is: "Can't connect to MySQL server on '***.***. ***.**' (61)", I checked a lot of information, there is a way to solve my problem:

Step 1: Check whether port 3306 is open and

use ufw (it will not be installed, please contact me),

sudo ufw status
or directly use the command
netstat -an | grep 3306
if the result shows something like: tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
It can be seen from the result that port 3306 is only listening on IP 127.0.0.1, so reject access from other IPs.

Step 2: Modify the configuration file

Modify the /etc/mysql/my.cnf file, open the file, and find the following content:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.bind
-address = 127.0.0.1
Comment out the above line or replace 127.0.0.1 with a suitable IP, it is recommended to comment it out.
After reboot, use netstat detection again:
~# netstat -an | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
Step 3:
Log in with the created user, success.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326924518&siteId=291194637