当前位置:网站首页>MySQL -- how to access the database of a computer in the same LAN (prenatal education level teaching)

MySQL -- how to access the database of a computer in the same LAN (prenatal education level teaching)

2022-06-23 01:33:00 July stars

Be careful : Method 1 、 Both operations are performed on the computer sharing the database

Method 1 、 be based on MySQL 5.5 Command Line Client Window

More direct than method two , But it is also possible that you did not choose to install this when installing , If installed , Just use method 1 , Use method 2 without installation .
 Insert picture description here
One 、 Double-click on the run MySQL 5.5 Command Line Client.
 Insert picture description here

Two 、 Input mysql Database password ,enter determine .
 Insert picture description here

3、 ... and 、 Input grant all privileges on *.* to [email protected]'%' identified by"root"; Back carriage return .
The purpose is to set up all in the LAN ip Can access this computer .
allprivileges Is all permissions , After the connection is completed, all permissions of the local database can be accessed by others .
% All users , If you change it to a certain ip It gives this person access to the local database .

Pay attention to make sure that ; Band No !
 Insert picture description here

Four 、 Step 4 enter , Show Query OK Indicates the operation is successful . Then you need to refresh the database , Input :flush privileges; Back carriage return , Note that you should also bring ;
 Insert picture description here

6、 ... and 、 Find... In the control panel “Window Defender A firewall ” And open
 Insert picture description here
 Insert picture description here

7、 ... and 、 Choose advanced settings
 Insert picture description here

7、 ... and 、 Select the inbound rule and click new rule
 Insert picture description here
8、 ... and 、 Select the port and click next
 Insert picture description here

Nine 、 Figure position input 80,3306 Click next all the time , The following names are for the convenience of distinguishing , Can write mysql Stack rules
 Insert picture description here

Method 2 、 be based on cmd Black window

 Insert picture description here
One 、 function cmd, Input mysql -u root -p
 Insert picture description here

Two 、 Input mysql Database password ,enter determine .
 Insert picture description here

3、 ... and 、 At this point, follow step 3 of method 1 and continue to finish


How other computers connect to this database

With Navicat for MySQL As an example
 Insert picture description here
make new connection
 Insert picture description here
Operate as shown in the figure
 Insert picture description here

Be careful :
1、3306 Is the default port number , As you set up above mysql Is related to the stack rules of .
2、 It's not just Navicat for MySQL, In other places, just put localhost Replace with the other party's IP Address That's all right.

Add :
How to check the computer IP Address :
1、 open cmd( Or command prompt )
2、 Input ipconfig/all
 Insert picture description here

原网站

版权声明
本文为[July stars]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202220516041493.html