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 NN 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_cachesetting. 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_cacheentries 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 TABLESstatement 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; ...
随机推荐
- mongo 操作符
1 $unset The $unset operator deletes a particular field. https://docs.mongodb.com/manual/reference/o ...
- Win10下安装虚拟机提示“Intel VT-x处于禁用状态”如何解决
今天在自己的笔记电脑上想安装一个Kali虚拟机学习用,安装的时候遇到这个问题,提示"Intel VT-x处于禁用状态". 要进入Win10的BIOS,先进入"设置&quo ...
- android开发里跳过的坑——TimePickerDialog onTimeSet不回调
在android6.0.1上测试发现TimePickerDialog的onTimeSet和DatePickerDialog的onDateSet不回调,查看SDK源码发现,TimePickerDialo ...
- msp430项目编程41
msp430综合项目---红外遥控直流电机调速系统41
- stm32f103定时器
1)TIM_TimeBaseInitTypeDef 时基初始化结构体,它包括了四个成员函数:TIM_ClockDivision.TIM_CounterMode.TIM_Period.TIM_Presc ...
- java多线程02-----------------synchronized底层实现及JVM对synchronized的优化
java多线程02-----------------synchronized底层实现及JVM对synchronized的优化 提到java多线程,我们首先想到的就是synchronized关键字,它在 ...
- Linux下Shell脚本运行程序不输出日志到终端
使用: 脚本路径/脚本名 >/dev/>& 说明: 可以简单的理解/dev/null是Linux下的回收站 >默认是把标准输出重定向 2>&1是把出错输出也定向 ...
- 《深入理解mybatis原理》 MyBatis缓存机制的设计与实现
本文主要讲解MyBatis非常棒的缓存机制的设计原理,给读者们介绍一下MyBatis的缓存机制的轮廓,然后会分别针对缓存机制中的方方面面展开讨论. MyBatis将数据缓存设计成两级结构,分为一级缓存 ...
- 电音中DJ/Producer/MC/EDM/Remix/Mix的名词解释(转)
DJ DJ是Disc Jockey的缩写,是电音圈子里的一种热门职业,一般大家在夜店或者酒吧看到的站在台上甩着膀子拧着按钮或者使劲儿搓碟的就是DJ啦. DJ的主要工作一般就是在现场用打碟机和混音台把许 ...
- 关于PDF的读取与绘制
本文方法参考了:官方文档.见A function that draw a PDF page的代码部分: void MyDisplayPDFPage (CGContextRef myContext, s ...