區分socket連線和tcp/ip連線

psufnxk2000發表於2015-05-08
mysql連線時,如果使用了localhost,那麼使用的是 socket連線。 感覺不應該是這個樣子。
今天測試:
所以,並不是朋友說的那個樣子。
mysql@localhost ~]$ mysql -u sla -p -h 127.0.0.1 
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 5 
Server version: 5.6.23-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial) 

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. 

Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

mysql> \s 
-------------- 
mysql Ver 14.14 Distrib 5.6.23, for Linux (x86_64) using EditLine wrapper 

Connection id: 5 
Current database: 
Current user: sla@localhost 
SSL: Not in use 
Current pager: stdout 
Using outfile: '' 
Using delimiter: ; 
Server version: 5.6.23-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial) 
Protocol version: 10 
Connection: 127.0.0.1 via TCP/IP 
Server characterset: utf8mb4 
Db characterset: utf8mb4 
Client characterset: utf8 
Conn. characterset: utf8 
TCP port: 3306 
Uptime: 33 min 44 sec 

Threads: 2 Questions: 18 Slow queries: 0 Opens: 70 Flush tables: 1 Open tables: 63 Queries per second avg: 0.008 
-------------- 



[mysql@localhost ~]$ mysql -u sla -p 
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 7 
Server version: 5.6.23-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial) 

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. 

Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

mysql> \s 
-------------- 
mysql Ver 14.14 Distrib 5.6.23, for Linux (x86_64) using EditLine wrapper 

Connection id: 7 
Current database: 
Current user: sla@localhost 
SSL: Not in use 
Current pager: stdout 
Using outfile: '' 
Using delimiter: ; 
Server version: 5.6.23-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial) 
Protocol version: 10 
Connection: Localhost via UNIX socket 
Server characterset: utf8mb4 
Db characterset: utf8mb4 
Client characterset: utf8 
Conn. characterset: utf8 
UNIX socket: /var/lib/mysql/mysql.sock 
Uptime: 4 hours 50 min 13 sec 

Threads: 2 Questions: 23 Slow queries: 0 Opens: 70 Flush tables: 1 Open tables: 63 Queries per second avg: 0.001 
--------------

轉載請註明源出處

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-1629941/,如需轉載,請註明出處,否則將追究法律責任。

相關文章