mysql socket连接比tcp连接方式更快
来源:互联网 发布:seo综合查询5118 编辑:程序博客网 时间:2024/04/29 18:00
mysql有两种连接方式,常用的一般是tcp
mysql 采用unix socket连接方式,比用tcp的方式更快,但只适用于mysql和应用同在一台PC上。如果不在同一台pc上,就没有办法连接了。而且我们可以把socket文件放在/dev/shm (内存)。/etc/mysql/my.cnf里面应该可以看到sock的配置条目,如果你跟我一样,是debian linux,注意要修改/etc/mysql/my.cnf和/etc/mysql/debian.cnf里面的配置。
以下是来自mysql官方手册的一段话:
http://dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.html
http://dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html
A MySQL client on Unix can connect to the mysqld server in two different ways: By using a Unix socket file to connect through a file in the file system (default /tmp/mysql.sock), or by using TCP/IP, which connects through a port number. A Unix socket file connection is faster than TCP/IP, but can be used only when connecting to a server on the same computer. A Unix socket file is used if you don’t specify a host name or if you specify the special host name loc -alhost.
mysql -h(ip) -uroot -pxxx #常用的mysql -S /tmp/mysqld.sock
mysql 采用unix socket连接方式,比用tcp的方式更快,但只适用于mysql和应用同在一台PC上。如果不在同一台pc上,就没有办法连接了。而且我们可以把socket文件放在/dev/shm (内存)。/etc/mysql/my.cnf里面应该可以看到sock的配置条目,如果你跟我一样,是debian linux,注意要修改/etc/mysql/my.cnf和/etc/mysql/debian.cnf里面的配置。
socket = /dev/shm/mysqld.sock
以下是来自mysql官方手册的一段话:
http://dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.html
http://dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html
A MySQL client on Unix can connect to the mysqld server in two different ways: By using a Unix socket file to connect through a file in the file system (default /tmp/mysql.sock), or by using TCP/IP, which connects through a port number. A Unix socket file connection is faster than TCP/IP, but can be used only when connecting to a server on the same computer. A Unix socket file is used if you don’t specify a host name or if you specify the special host name loc -alhost.
转自:http://www.ayhacker.net/ayblog/read.php?77
- mysql socket连接比tcp连接方式更快
- socket中TCP连接
- TCP socket 长连接
- tcp/udp socket连接
- TCP、HTTP、SOCKET连接
- TCP面向连接Socket
- TCP连接、Http连接与Socket连接
- TCP连接、Http连接与Socket连接
- TCP连接、Http连接与Socket连接
- TCP连接、Http连接与Socket连接
- TCP连接、Http连接与Socket连接
- 基于事件的异步Socket(TCP连接方式)
- 基于事件的异步Socket(TCP连接方式)
- TCP连接、Http连接与Socket连接 ,UDP连接
- socket连接和TCP连接的关系
- SOCKET连接与TCP/IP连接
- socket连接和TCP连接的关系
- TCP的socket连接示例
- StrangeDictionary2(SRM542-div1-2)
- WINDOW进程通信的几种方式
- POJ4044 A Score Sequence
- Top 10 Reasons to Use HTML5 Right Now
- 2012.5.11
- mysql socket连接比tcp连接方式更快
- lwxshow.com资源-Mac 上在office OpenOffice download 中文版,高速,迅雷下载
- C++虚函数
- power design 设计oracle数据库使用过程中注意点
- wp_list_categories
- linux设备驱动模型一三基础结构之Kobject
- android 学习之一spinner的学习一
- C or java
- WinCE 5.0常用函数收集整理