我正在运行这个版本的Mysql
Ver 14.14 Distrib 5.6.24,for debian-linux-gnu (x86_64)
在这个版本的Ubuntu
Distributor ID: Ubuntu Description: Ubuntu 15.04 Release: 15.04 Codename: vivid
这是我为Mysql设置的配置:
key_buffer_size = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8 innodb_buffer_pool_size=20G innodb_log_buffer_size=16M tmp_table_size = 32M max_heap_table_size = 32M open-files-limit=4510 max_connections=500 myisam-recover = BACKUP query_cache_type=1 query_cache_limit = 32M query_cache_size = 32M
这些是在启动MYSQL时不断得到的警告:
2015-06-17 17:28:53 26720 [Warning] Buffered warning: Could not increase number of max_open_files to more than 1024 (request: 4510) 2015-06-17 17:28:53 26720 [Warning] Buffered warning: Changed limits: max_connections: 214 (requested 500) 2015-06-17 17:28:53 26720 [Warning] Buffered warning: Changed limits: table_open_cache: 400 (requested 2000)
我已经尝试过这些步骤:
1)将它添加到/etc/security/limits.conf中
mysql soft nofile 65535 mysql hard no file 65535
2)将它添加到/etc/pam.d/common-auth和/etc/pam.d/commom-session
session required pam_limits.so
3)将其添加到/etc/mysql/mysql.conf.d/mysqld.cnf
open-files-limit=4510 or open_files_limit=4510
这些都没有工作,我仍然无法将mysql max连接提高到500。
在这一点上,我真的很感激一些帮助。
非常感谢。
Ubuntu已经从Upstart迁移到版本15.04中的Systemd,并且不再尊重系统服务的/etc/security/limits.conf中的限制。这些限制现在只适用于用户会话。
MySQL服务的限制在Systemd配置文件中定义,您应该从默认位置复制到/ etc / systemd中,然后编辑副本。
sudo cp /lib/systemd/system/mysql.service /etc/systemd/system/ sudo vim /etc/systemd/system/mysql.service # or your editor of choice
将以下行添加到文件的底部:
LimitNOFILE=infinity LimitMEMLOCK=infinity
您还可以设置数字限制,例如LimitNOFILE = 4510。
现在重新加载Systemd配置:
sudo systemctl daemon-reload
重新启动MySQL,现在应该遵守max_connections指令。
升级到15.04之后,我也有麻烦地把MySQL干掉。如果这会影响你(你会知道,因为在服务mysql停止或服务mysql重新启动时需要花费300秒时间),然后将以下行添加到相同的/etc/systemd/system/mysql.service文件中为了我:
ExecStop=/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf shutdown
后一个问题似乎已经由16.04修复,并且不再需要这一行,因此在进行分发升级之前,您将要停止MySQL并从配置文件中删除ExecStop行。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。