MySQL connection Mode 1:TCP/IP Socket mode This approach establishes a network-based connection request on a TCP/IP connection, typically a client connection to a MySQL instance running on the server, and 2 machines connected via a TCP/IP network. C:\users\gechong>mysql-h192.168.1.10-uroot-p
Enter Password: *******
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is6
Server version:5.5. --log MySQL Community Server (GPL)
Copyright (c) -, ., Oracle and/or its affiliates. All rights reserved.
Oracle isA registered trademark of Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type'Help ;'Or'\h' forHelp. Type'\c'To clear the current input statement.
Mysql> the client here is windows, which initiates a TCP/IP request to the MySQL instance on the IP-192.168.1.10 server, and MySQL is available after the connection is successful. You can view:mysql> SELECT User,host,password from Mysql.user \g
***************************1. Row ***************************
User:root
Host:localhost
Password: *11b9aca21786f766739d0eb1483c5f64212b81ac
***************************2. Row ***************************
User:root
Host127.0.0.1
Password: *11b9aca21786f766739d0eb1483c5f64212b81ac
***************************3. Row ***************************
User:gechong
Host:localhost
Password: *7ae39be5035d5c32361400ff7dedd757aa76896a
3RowsinchSet(0.02SEC) This permission table clearly shows which users MySQL is allowed to connect in which IP segments 2:unix domain sockets UNIX domain sockets are not network protocols, so they can only be used on a single server for MySQL clients and DB instances. The user can specify a socket file in the configuration file--socket=/tmp/mysql.sock
Mysql> SHOW VARIABLES like'Socket';
+---------------+-----------------+
| variable_name | Value |
+---------------+-----------------+
| sockets | /tmp/mysql.sock |
+---------------+-----------------+
1RowinchSet(0.00Sec
#Mysql-uroot-s/tmp/mysql.sock
MySQL Connection mode