MySQL服务器设置优化之一-数据库连接速度调优

#MySQL服务器设置优化之一-数据库连接速度调优

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

环境:
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


觉得文章对你有帮助,可以扫描二维码捐赠给博主,谢谢!
在这里插入图片描述
如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:129518033

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

itas109

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值