區分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
- Http和Socket連線區別HTTP
- Http 和TCP的關係,TCP長連線和短連線有什麼區別?HTTPTCP
- Linux配置支援高併發TCP連線(socket最大連線數)LinuxTCP
- 什麼是Socket連線?它與TCP連線有什麼關係TCP
- tcp 連線TCP
- 12、Swoole 中 TCP、UDP 和長連線、短連線TCPUDP
- Go Socket 連線Go
- tcp的半連線攻擊和全連線攻擊--TCP DEFER ACCEPTTCP
- TCP 連線管理TCP
- 等值連線和自然連線的區別
- http Socket長連線HTTP
- TCP 三次握手原理以及半連線和全連線TCP
- golang tcp連線池GolangTCP
- TCP的連線建立TCP
- 連線和半連線
- LAN連線和WAN連線有什麼區別?
- 限制單個IP併發TCP連線的方法TCP
- TCP-ip建立連線時3次握手,斷開連線時4次揮手TCP
- telnet連線socket serverServer
- Windows Socket 最大連線數Windows
- flash無法連線socket
- .NET Socket TCP 50W線上連線互動測試TCP
- 為什麼多 TCP 連線分塊下載比單連線下載快TCP
- TCP/IP 和SocketTCP
- SQL Server中內連線和外連線的區別SQLServer
- 長連線和短連線
- 左連線和右連線
- 統計TCP連線數和狀態TCP
- 聊聊 TCP 長連線和心跳那些事TCP
- TCP連線注意事項TCP
- 限制單個IP併發TCP連線的方法(轉)TCP
- TCP建立連線三次握手和釋放連線四次握手TCP
- 系列TCP/IP協議-TCP建立與終止連線(012)TCP協議
- 【Android】Socket連線-RxSocketAndroid
- socket與TCP/IP區別TCP
- sql 內連線和外連線SQL