Edit the main MySQL configuration file(s) under /etc/mysql, and make the following changes. The exact files to edit vary by MySQL version and Linux distribution. The [mysqld] and [mysqld_safe] sections may need created if they don't already exist.

Add to [mysqld_safe]

open-files-limit = 65535

Add to [mysqld]

expire_logs_days = 7
innodb_flush_log_at_trx_commit = 2
innodb_log_file_size = 64M
master_info_repository = table
max_connections = 1000
max_user_connections = 990
relay_log_info_repository = table
table_open_cache = 1024

On larger systems (1000 concurrent calls or more), if memory allows, also add to [mysqld]

innodb_buffer_pool_size = 20G

Only if using MySQL 8.0 or later, also add to [mysqld]

innodb_numa_interleave = on
sql_mode = "NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
default-authentication-plugin = mysql_native_password

Only if using MySQL 5.X revision 5.7.5 or later, or if using MariaDB, also add to [mysqld]

sql_mode = "NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

If using systemd

  • systemctl edit mysql # for Debian based platforms
  • systemctl edit mysqld # for Fedora, CentOS and RHEL platforms
  • Add the following lines to the edited file and save it:
    			[Service]
    			LimitNOFILE=65535
    		
  • systemctl daemon-reload