MySQL调优之一-数据库连接速度调优

2018-01-13 11:02:21来源:网络收集作者:管理员人点击

分享

阿里云爆款
MySQL调优之一-数据库连接速度调优

如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:12951803


环境:
MySQL版本:5.5.15
操作系统:windows


1.禁止域名解析

优化参数:skip-name-resolve
参数作用:禁止域名解析的(包括主机名)。仅适用IP地址进行连接。如果使用此选项,授予表中的所有主机列值必须是IP地址或本地主机(localhost)。
优化方法:
在mysql的配置文件my.ini中添加skip-name-resolve参数。


[mysqld]
# Skip reverse DNS lookup of clients
skip-name-resolve


注意:
配置文件中加入skip-name-resolve就表示禁用域名解析,删除该参数就表示开启域名解析。不需要设置skip-name-resolve=ON或者skip-name-resolve=OFF,这些都是不正确的


原文:
–skip-name-resolve


Do not resolve host names when checking client connections. Use only IP addresses. If you use this option, all Host column values in the grant tables must be IP addresses or localhost. See Section 8.12.5.2, “DNS Lookup Optimization and the Host Cache”.


Depending on the network configuration of your system and the Host values for your accounts, clients may need to connect using an explicit –host option, such as –host=localhost, –host=127.0.0.1, or –host=::1.


An attempt to connect to the host 127.0.0.1 normally resolves to the localhost account. However, this fails if the server is run with the –skip-name-resolve option, so make sure that an account exists that can accept a connection. For example, to be able to connect as root using –host=127.0.0.1 or –host=::1, create these accounts:


CREATE USER 'root'@'127.0.0.1' IDENTIFIED BY 'root-password';
CREATE USER 'root'@'::1' IDENTIFIED BY 'root-password';
2.禁止TCP/IP连接

优化参数:skip-networking
参数作用:禁止TCP/IP连接。所有与mysqld的交互都必须使用命名管道或共享内存(在Windows上)或Unix套接字文件(在Unix上)。 强烈建议仅允许本地客户端的系统使用此选项。
优化方法:
在mysql的配置文件my.ini中添加skip-networking参数。


[mysqld]
#Do not listen for TCP/IP connections at all
skip-networking


注意:
开启该选项后就不能远程访问MySQL
为安全考虑希望指定的IP访问MySQL,可以在配置文件中增加bind-address=IP,前提是关闭skip-networking
bind-address=192.168.1.100


原文:
–skip-networking


Do not listen for TCP/IP connections at all. All interaction with mysqld must be made using named pipes or shared memory (on Windows) or Unix socket files (on Unix). This option is highly recommended for systems where only local clients are permitted. See Section 8.12.5.2, “DNS Lookup Optimization and the Host Cache”.


Reference:
https://dev.mysql.com/doc/refman/5.5/en/server-options.html


觉得文章对你有帮助,可以用微信扫描二维码捐赠给博主,谢谢!
MySQL调优之一-数据库连接速度调优
如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:12951803


最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台