區分socket連線和tcp/ip連線
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
--------------
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
--------------
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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Socket和TCP連線過程解析TCP
- Socket連線和Http連線HTTP
- 什麼是Socket連線?它與TCP連線有什麼關係TCP
- tcp 連線TCP
- Go Socket 連線Go
- 12、Swoole 中 TCP、UDP 和長連線、短連線TCPUDP
- tcp的半連線攻擊和全連線攻擊--TCP DEFER ACCEPTTCP
- TCP 連線管理TCP
- telnet連線socket serverServer
- 【Android】Socket連線-RxSocketAndroid
- TCP 三次握手原理以及半連線和全連線TCP
- 系列TCP/IP協議-TCP建立與終止連線(012)TCP協議
- TCP/IP 和SocketTCP
- 限制單個IP併發TCP連線的方法TCP
- LAN連線和WAN連線有什麼區別?
- socket與TCP/IP區別TCP
- 聊聊 TCP 長連線和心跳那些事TCP
- 統計TCP連線數和狀態TCP
- 從Linux原始碼看Socket(TCP)的listen及連線佇列Linux原始碼TCP佇列
- TCP連線注意事項TCP
- 長連線和短連線
- Libevent應用 (五) 連線監聽器,接收tcp連線TCP
- TCP連線是如何建立和終止的?TCP
- sql 內連線和外連線SQL
- Socket程式設計-長連線與短連線,心跳(keep-alive)程式設計Keep-Alive
- Frp分別用tcp和stcp模式ssh連線到內網LinuxFRPTCP模式內網Linux
- 簡述Socket連線的過程
- python中socket建立客戶連線Python
- Android Socket連線,使用Socket進行通訊(Android)Android
- http的長連線和短連線HTTP
- 長連線和短連線的使用
- 連線池和連線數詳解
- TCP/IP、HTTP和Socket總結TCPHTTP
- 內連線、左連線、右連線
- Luat例項教程:tcp短連線TCP
- 最多能建立多少個 TCP 連線?TCP
- TCP socket和web socket的區別TCPWeb
- 手把手教你寫 Socket 長連線
- 如何用ip地址連線共享印表機 用ip地址連線共享印表機的方法