MySQL interconnection between two win10

Time:2022-1-4

Today, I tried the MySQL connection between two computers. I had a whim today, but the whole process took a long time.

Test environment:

PC1: win10

Install mysql5 seven point three one
IP: 192.168.1.202

PC2: win10

Install mysql5 seven point three one
IP: 192.168.1.203

1. First connection test

1.1 PC1 connection PC2

PC1连接PC2

1.2 PC2 connection PC1

PC2连接PC1

1.3 problem solving

After finding the problem on the Internet, I found that the port was blocked because the firewall blocked it. So I modified it according to the prompt. After that, the Ping was passed and half of it was completed.

The solution is to turn on the firewall of the computerFile and print sharingProvide a port for Ping.

Specific steps

Control panel – > system and security – > Windows Defender Firewall – > Advanced Settings – > inbound rules – > file and print sharing (echo request – icmpv4 in) – > right click – > enable rules

reference material

CSDN: summary of the problem that two computers cannot Ping under the LAN
System city: what if the win10 pure version and win10 professional version computers fail to Ping

2. Database users

Because the MySQL databases of the two computers access each other, the user’s host needs to be changed to the specified IP or any IP.

Here, take PC1 connecting to PC2 as an example. Create a new user JUKI in the MySQL database of PC2. The host can be PC1’s IP or%,% represents any IP, and all hosts can access it. This is obviously not very safe. It is only for testing and trial.

--Create user JUKI
insert into mysql.user(host,user,authentication_string,ssl_cipher,x509_issuer,x509_subject) values('%', 'juki', password('juki233'), '','','');

--Make new users effective
flush privileges;

--View user information
select user,host from mysql.user;

创建用户

reference material

Baidu experience: how to solve the error that MySQL does not allow remote connection

3. Connect to the database

As soon as the connection problem came out again, it showed that the remote server could not be connected. After that, I found a lot of information, most of which are MySQL servers based on Linux. The solution is to comment it outmysql.cnfIn the filebind-address=127.0.0.1This line, but it doesn’t solve my problem

PC1测试登录PC2的juki用户

Finally, I found an effective solution. My simple understanding of this solution is to open another port for MySQL:Blog Garden: remote connection to MySQL under Windows, I followed the steps and finally finished it, nice~~~

PC1成功登录PC2的juki用户

Recommended Today

SuperMap GIS Service acceleration solution

###1. brief introductionSuperMapIn addition to generating a cache for the content requested by the user, the map cache produced in iserver can also be pushed to Iexpress through intelligent cache distribution. Therefore, the service request of the client can be directly responded by Iexpress, so as to improve the service efficiency.####1.1SuperMap acceleration scheme consists of […]