How MySQL Opens and Closes Tables refuse connections 拒绝连接的原因 file descriptors
MySQL :: MySQL 5.7 Reference Manual :: 8.4.3.1 How MySQL Opens and Closes Tables https://dev.mysql.com/doc/refman/5.7/en/table-cache.html
8.4.3.1 How MySQL Opens and Closes Tables
When you execute a mysqladmin status command, you should see something like this:
Uptime: 426 Running threads: 1 Questions: 11082
Reloads: 1 Open tables: 12
The Open tables
value of 12 can be somewhat puzzling if you have only six tables.
MySQL is multi-threaded, so there may be many clients issuing queries for a given table simultaneously. To minimize the problem with multiple client sessions having different states on the same table, the table is opened independently by each concurrent session. This uses additional memory but normally increases performance. With MyISAM
tables, one extra file descriptor is required for the data file for each client that has the table open. (By contrast, the index file descriptor is shared between all sessions.)
The table_open_cache
and max_connections
system variables affect the maximum number of files the server keeps open. If you increase one or both of these values, you may run up against a limit imposed by your operating system on the per-process number of open file descriptors. Many operating systems permit you to increase the open-files limit, although the method varies widely from system to system. Consult your operating system documentation to determine whether it is possible to increase the limit and how to do so.
table_open_cache
is related to max_connections
. For example, for 200 concurrent running connections, specify a table cache size of at least 200 *
, where N
N
is the maximum number of tables per join in any of the queries which you execute. You must also reserve some extra file descriptors for temporary tables and files.
Make sure that your operating system can handle the number of open file descriptors implied by the table_open_cache
setting. If table_open_cache
is set too high, MySQL may run out of file descriptors and refuse connections, fail to perform queries, and be very unreliable.
0-连接数不够:软件,增大max_connections;
1-系统资源不足:硬件,file descriptors 不足,改善硬件(增大 --open-files-limit
)。
You should also take into account the fact that the MyISAM
storage engine needs two file descriptors for each unique open table. For a partitioned MyISAM
table, two file descriptors are required for each partition of the opened table. (Note further that when MyISAM
opens a partitioned table, it opens every partition of this table, whether or not a given partition is actually used. See MyISAM and partition file descriptor usage.) You can increase the number of file descriptors available to MySQL using the --open-files-limit
startup option to mysqld. SeeSection B.5.2.17, “File Not Found and Similar Errors”.
The cache of open tables is kept at a level of table_open_cache
entries. The server autosizes the cache size at startup. To set the size explicitly, set the table_open_cache
system variable at startup. Note that MySQL may temporarily open more tables than this to execute queries.
MySQL closes an unused table and removes it from the table cache under the following circumstances:
When the cache is full and a thread tries to open a table that is not in the cache.
When the cache contains more than
table_open_cache
entries and a table in the cache is no longer being used by any threads.When a table flushing operation occurs. This happens when someone issues a
FLUSH TABLES
statement or executes a mysqladmin flush-tables or mysqladmin refresh command.
How MySQL Opens and Closes Tables refuse connections 拒绝连接的原因 file descriptors的更多相关文章
- HOW MYSQL USES INTERNAL TEMPORARY TABLES
HOW MYSQL USES INTERNAL TEMPORARY TABLES Table of Contents [hide] 1)UNION queries 2)Some views 3)SQL ...
- Nagios显示器mysql定从库: libmysqlclient.so.18: cannot open shared object file: No such
做mysql的slave时间监控,必须check_mysql文字,check当误差: error while loading shared libraries: libmysqlclient.so.1 ...
- Apache Tomcat/6.0.39如何配置连接mysql,JDBC:mysql-connector-java-5.1.30-bin.jar-成功连接心得
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html 前提:开启TOMCAT,MYsql MySQL ...
- 解决 phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接 问题
phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接.您应该检查配置文件中的主机.用户名和密码,并确认这些信息与 MySQL 服务器管理员所给出的信息一致. 问题解决办法: 修改co ...
- MySQL多表查询之外键、表连接、子查询、索引
MySQL多表查询之外键.表连接.子查询.索引 一.外键: 1.什么是外键 2.外键语法 3.外键的条件 4.添加外键 5.删除外键 1.什么是外键: 主键:是唯一标识一条记录,不能有重复的,不允许为 ...
- phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接。
phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接.您应该检查配置文件中的主机.用户名和密码,并确认这些信息与 MySQL 服务器管理员所给出的信息一致. 错误产生原因: 修改了 ...
- 以Tomcat+Mysql为例,实现Docker多容器连接
Docker提供了多个容器直接访问的方法,最简单的方式是直接使用端口映射-p参数指定映射的端口或者-P映射所有端口,多个容器直接通过网络端口进行访问. 但网络端口映射方式并不是Docker中连接多个容 ...
- Mac OS本地,XAMPP,出现 “phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接”错误
phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接.您应该检查配置文件中的主机.用户名和密码,并确认这些信息与 MySQL 服务器管理员所给出的信息一致. 原因一:有可能是因为修改 ...
- MySQL Connector/ODBC 2.50 (MyODBC 2.50)连接方式
一.MySQL Connector/ODBC 2.50 (MyODBC 2.50)连接方式 1.本地数据库连接Driver={MySQL};Server=localhost;Option=16834; ...
随机推荐
- vamare下centos7.0 动态获取ip报错问题
CentOS7 Failed to start LSB: Bring up/down解决方法 centos7.0中service network restart重启报错的问题 报错信息: /etc/i ...
- [luoguP2053] [SCOI2007]修车(最小费用最大流)
传送门 网络流的建图真的好难! 将一个点拆分成多个点的思想还需要加强. 题解 代码和题解中的图略不一样. #include <queue> #include <cstdio> ...
- 转载:lua和c的交互
extern "C" { #include "lua.h" #include "lualib.h" #include "lauxl ...
- 修改系统dpi
系统dpi设置不合理,会导致屏幕显示效果差.配置系统dpi设置ro.sf.lcd_density的值即可,不同项目设置位置不同,以高通为例:需要修改 项目/device/qcom/common/roo ...
- Gauss 高斯消元
高斯消元…… (裸的暴力) 如果你有一个n元的方程组你会怎么办? Ans:直接用初中的解方程组的方法呀! 没错,直接暴力加减消元.那什么是“高斯消元”?说白了,就是普通的加减消元罢了. 本人再考场上打 ...
- Cards BZOJ 1004
Cards [问题描述] 小春现在很清闲,面对书桌上的N张牌,他决定给每张染色,目前小春只有3种颜色:红色,蓝色,绿色.他询问Sun有多少种染色方案,Sun很快就给出了答案.进一步,小春要求染出Sr张 ...
- leetcode 318. Maximum Product of Word Lengths
传送门 318. Maximum Product of Word Lengths My Submissions QuestionEditorial Solution Total Accepted: 1 ...
- numpy数组之读写文件
目录 通过 numpy 读写 txt 或 csv 文件 通过 numpy 读写 npy 或 npz 文件 读写 npy 文件 读写 npz 文件 通过 h5py 读写 hdf5 文件 简单读取 通过切 ...
- php 笔记 汇总 学习
php命令行:通过命令行进入到当前要被执行的php文件路径,然后输入php环境可执行路径(后面包含php.exe),然后输入要被执行的php文件,比如runData.php即可. php框架:yaf. ...
- Linux下xz与tar的区别
同一文件,tar.xz格式比tar.gz格式小了三分之一! 说明: xz是一个使用LZMA压缩算法的无损数据压缩文件格式. 和gzip与bzip2一样,同样支持多文件压缩,但是约定不能将多于一个的目标 ...