mysql報錯Changed limits: max_open_files: 5000
OS:CentOS 7.4
DB:mysql 5.7.17
error.log日誌裡報錯資訊:
看到這個錯誤第一反應是去資料庫查查當前的引數都是多少,和日誌裡提示的是一樣的
看到是max_open_files,難道是作業系統限制了?也沒有啊
my.cnf檔案裡也沒有對這些引數做修改,因為是用mysqld.service啟動的,難道是這個檔案的問題嗎?
果然是...把這個引數修改為65535後,重啟mysql,問題消失了。
https://dev.mysql.com/doc/refman/5.7/en/using-systemd.html
DB:mysql 5.7.17
error.log日誌裡報錯資訊:
-
2018-04-08T09:52:52.641263Z 0 [Warning] Changed limits: max_open_files: 5000 (requested 50000)
-
2018-04-08T09:52:52.641467Z 0 [Warning] Changed limits: max_connections: 4190 (requested 10000)
- 2018-04-08T09:52:52.641476Z 0 [Warning] Changed limits: table_open_cache: 400 (requested 2000)
-
mysql> show variables like '%files%';
-
+---------------------------+--------+
-
| Variable_name | Value |
-
+---------------------------+--------+
-
| character_set_filesystem | binary |
-
| innodb_log_files_in_group | 2 |
-
| innodb_open_files | 400 |
-
| keep_files_on_create | OFF |
-
| large_files_support | ON |
-
| open_files_limit | 5000 |
-
+---------------------------+--------+
-
6 rows in set (0.00 sec)
-
-
mysql> show variables like '%connections%';
-
+----------------------+-------+
-
| Variable_name | Value |
-
+----------------------+-------+
-
| max_connections | 4190 |
-
| max_user_connections | 0 |
-
+----------------------+-------+
-
2 rows in set (0.00 sec)
-
-
-
mysql> show variables like '%table_open_cache%';
-
+----------------------------+-------+
-
| Variable_name | Value |
-
+----------------------------+-------+
-
| table_open_cache | 400 |
-
| table_open_cache_instances | 16 |
-
+----------------------------+-------+
- 2 rows in set (0.01 sec)
看到是max_open_files,難道是作業系統限制了?也沒有啊
-
[root@iz2ze6jo3o3bqbcongnypoz mysql]# ulimit -n
- 65535
-
[root@iz2ze6jo3o3bqbcongnypoz system]# more /usr/lib/systemd/system/mysqld.service
-
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
-
#
-
# This program is free software; you can redistribute it and/or modify
-
# it under the terms of the GNU General Public License as published by
-
# the Free Software Foundation; version 2 of the License.
-
#
-
# This program is distributed in the hope that it will be useful,
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
# GNU General Public License for more details.
-
#
-
# You should have received a copy of the GNU General Public License
-
# along with this program; if not, write to the Free Software
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
#
-
# systemd service file for MySQL forking server
-
#
-
-
[Unit]
-
Description=MySQL Server
-
Documentation=man:mysqld(8)
-
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
-
After=network.target
-
After=syslog.target
-
-
[Install]
-
WantedBy=multi-user.target
-
-
[Service]
-
User=mysql
-
Group=mysql
-
-
Type=forking
-
-
PIDFile=/var/run/mysqld/mysqld.pid
-
-
# Disable service start and stop timeout logic of systemd for mysqld service.
-
TimeoutSec=0
-
-
# Execute pre and post scripts as root
-
PermissionsStartOnly=true
-
-
# Needed to create system tables
-
ExecStartPre=/usr/bin/mysqld_pre_systemd
-
-
# Start main service
-
ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS
-
-
# Use this to switch malloc implementation
-
EnvironmentFile=-/etc/sysconfig/mysql
-
-
# Sets open_files_limit
- LimitNOFILE = 5000
果然是...把這個引數修改為65535後,重啟mysql,問題消失了。
- LimitNOFILE = 5000 這個值預設就是5000,下面這篇文件說清楚這個事了:
https://dev.mysql.com/doc/refman/5.7/en/using-systemd.html
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20893244/viewspace-2152685/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- el-upload拍照上傳多個檔案報錯 ERR_UPLOAD_FILE_CHANGED問題
- Mysql8.0 報錯MySql
- mysql執行報錯mysql.sockMySql
- mysql checksum 報錯問題。MySql
- MySql報錯(持續更新)MySql
- mysql 報錯 Communications link failureMySqlAI
- mysql報錯程式碼彙總MySql
- Oracle Physical Database LimitsOracleDatabaseMIT
- MySQL更新卡住報錯lock wait timeoutMySqlAI
- mysql 8.0 使用 navicat 登入報錯MySql
- MySQL查詢取別名報錯MySql
- Mysql自動處理同步報錯MySql
- mysql5.6 mysqldump備份報錯MySql
- 半同步複製報錯mysql8.0.25MySql
- mysql報1045錯誤是什麼意思MySql
- mysql匯入報錯怎麼解決?MySql
- laravel mysql批量提交報Access denied 錯誤LaravelMySql
- Mysql報錯注入原理分析(count()、rand()、group by)MySql
- 報錯install_driver(mysql) failed: Attempt to reload DBD/mysql.pmMySqlAI
- Navicat連線centos裡mysql報錯Host is not allowed to connect to this MySQL serverCentOSMySqlServer
- WPF Backgroundworker dowork work completed progress changed
- WPF ListBox ListBoxItem programmatically selected and changed foreground
- Mysql資料庫報ERROR 1045 (28000)報錯及MySQL忘記密碼找回MySql資料庫Error密碼
- 【MySQL速通篇001】5000字吃透MySQL部分重要知識點MySql
- Oracle:/etc/security/limits.confOracleMIT
- nginx 修改 max open files limitsNginxMIT
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- MySql5.7及以上 ORDER BY 報錯問題MySql
- MySql報錯:Lock wait timeout exceeded: try restadina transactionMySqlAIREST
- MySQL 啟動報錯 error while loading shared librariesMySqlErrorWhile
- MYSQL timestamp NOT NULL插入NULL的報錯問題MySqlNull
- MySQL報錯ERROR 2013 (HY000): Lost connection to MySQL server during queryMySqlErrorServer
- 解決MySql報錯:1130 - Host ‘xxx‘ is not allowed to connect to this MySQL server的方法MySqlServer
- Mysql資料庫使用Navicat Mysql匯入sql檔案報錯MySql資料庫
- 2Gb - File limits in Oracle(轉)MITOracle
- 升級到 MySQL 8.4,MySQL 啟動報錯:io_setup() failed with EAGAINMySqlAI
- MySQL Insert資料量過大導致報錯 MySQL server has gone awayMySqlServerGo
- 安裝MySQL5.7報錯:The action ‘Install’ for product ‘MySQL Server 5.7.19’ failed.MySqlServerAI