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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Mysql8.0 報錯MySql
- std::numeric_limits::max() std::numeric_limits::min()編譯錯誤MIT編譯
- mysql執行報錯mysql.sockMySql
- MySql報錯(持續更新)MySql
- mysql checksum 報錯問題。MySql
- MYSQL SOURCE報錯 ERROR: ASCIIMySqlErrorASCII
- Oracle 10g Limits - Logical Database LimitsOracle 10gMITDatabase
- el-upload拍照上傳多個檔案報錯 ERR_UPLOAD_FILE_CHANGED問題
- mysql報錯ERROR 1093MySqlError
- 【Mysql】into outfile報錯的問題MySql
- 安裝mysql 5.5.14 報錯MySql
- mysql報錯程式碼彙總MySql
- mysql登陸報錯mysql: unknown variable 'basedir=MySql
- SSH登陸錯誤 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!REMIDE
- Physical Database LimitsDatabaseMIT
- limits.hMIT
- teradata limitsMIT
- MySQL查詢取別名報錯MySql
- mysql 8.0 使用 navicat 登入報錯MySql
- mysql5.6 mysqldump備份報錯MySql
- Mysql自動處理同步報錯MySql
- mysql 報錯 Communications link failureMySqlAI
- MySQL 建立儲存過程報錯MySql儲存過程
- MySQL報錯 Error_code: 1045MySqlError
- 安裝MYSQL ODBC5.3報錯MySql
- mysql複製報錯案例處理MySql
- 透過Amoeba連線mysql報錯MySql
- MySQL 啟動報錯 Table 'mysql.plugin' doesn't existMySqlPlugin
- mysql起動報錯TheserverquitwithoutupdatingPIDfile/usr/local/mysql/data/MySqlServerUI
- Oracle Physical Database LimitsOracleDatabaseMIT
- Mysql報錯注入原理分析(count()、rand()、group by)MySql
- mysql匯入報錯怎麼解決?MySql
- laravel mysql批量提交報Access denied 錯誤LaravelMySql
- 半同步複製報錯mysql8.0.25MySql
- mysql安裝/啟動報錯彙總MySql
- mysql MRG_MyISAM 引擎報錯解決MySql
- Table '.\mysql\proc' is marked as crashed and should be repaired 報錯MySqlAI
- mysql報錯Accessdeniedforuser'root'@'localhost'(usingpassword:YES)MySqllocalhost