zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

MySQL Variables back_log 数据库 参数变量解释及正确配置使用

mysql数据库log配置变量 使用 解释 参数
2023-06-13 09:11:25 时间
本站中文解释

MySQL的 back_log 参数用于指定MySQL服务器的TCP/IP连接队列的大小。这个参数用来确定MySQL服务器可以接受的最大连接数,因为在任何时候,MySQL服务器的进程都在处理客户端的请求,如果一次处理太多请求,就需要增加连接队列大小,如果太少,就会发生超时,许多客户端就不能够连接到MySQL服务器。

通过在MySQL服务器中设置back_log参数,可以确定MySQL服务器可以接受的最大连接数;通常将back_log参数设置为系统最大连接数的2倍,即32个;如果您的服务器连接频繁,您可以将其设置的更大,如64个。

设置back_log参数的方法如下:
第一步:登录mysql服务器,进入mysql终端。
第二步:加载mysql参数变量文件(my.cnf),执行命令:mysql source my.cnf
第三步:执行命令行:mysql SET GLOBAL back_log= N 。其中,N为设定的back_log参数值。
第四步:查看设置是否生效,执行命令:mysql show variables like “back_log”;
第五步:保存修改。执行命令:mysql service mysql restart 或 重启mysql服务。

官方英文解释 back_log


The number of outstanding connection requests MySQL can have.
This comes into play when the main MySQL thread gets very many
connection requests in a very short time. It then takes some
time (although very little) for the main thread to check the
connection and start a new thread. The
back_log value indicates how
many requests can be stacked during this short time before
MySQL momentarily stops answering new requests. You need to
increase this only if you expect a large number of connections
in a short period of time.

In other words, this value is the size of the listen queue for
incoming TCP/IP connections. Your operating system has its own
limit on the size of this queue. The manual page for the Unix
listen() system call should have more
details. Check your OS documentation for the maximum value for
this variable. back_log
cannot be set higher than your operating system limit.

The default value is based on the following formula, capped to
a limit of 900:

50 + (max_connections / 5)


我想要获取技术服务或软件
服务范围:MySQL、ORACLE、SQLSERVER、MongoDB、PostgreSQL 、程序问题
服务方式:远程服务、电话支持、现场服务,沟通指定方式服务
技术标签:数据恢复、安装配置、数据迁移、集群容灾、异常处理、其它问题

本站部分文章参考或来源于网络,如有侵权请联系站长。
数据库远程运维 MySQL Variables back_log 数据库 参数变量解释及正确配置使用