您的位置:首页 > 数据库 > MySQL

mysql貌似因为连接数太大而连接不上,根据网上的教程,写份查询连接数命令的总结

2017-07-04 00:00 1186 查看
首先是要进入到mysql的命令行,

然后执行语句

查询最大可连接数

show variables like '%max_connections%';




查询一下当前的连接数

show processlist;




或者这条语句也同样可以查询

show status like 'Threads%';




这里面的Threads_connected即为连接数。

-------------------------------------------------------------------------------

(单行线内的内容,唔,未必需要看)

而其他的参数

Threads_cached 在使用手册上的解释是

The number of threads in the thread cache.
This variable is not meaningful in the embedded server (libmysqld) and as of MySQL 5.7.2 is no
longer visible within the embedded server.

译为

线程缓存中的连接数.

这个参数在嵌入式服务器(libmysqld )中没有意义,而从mysql 5.7.2开始在嵌入式服务器内这个参数就不再存在(唔,应该是这个意思)

Threads_connected

The number of currently open connections.

译为
当前打开的连接数

Theads_created

The number of threads created to handle connections. If Threads_created is big, you may
want to increase the thread_cache_size value. The cache miss rate can be calculated as
Threads_created/Connections.

这个数量代表着:为了处理链接,创建的线程有多少条。如果这个数量很大,你可以去增加thread_cache_size的值.这个缓存丢失率等于 Threads_created除以Connections.

Thread_running

The number of threads that are not sleeping.

并未处于休眠状态的线程数量。

---------------------------------------------------------------------------------

如果运行中的数量很大的话,可以将数据库可运行数量增大,或者直接重启数据库。

如果是linux下的话

service mysqld restart
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  MySQL