Connection Limit Exceeded
When encountering "Too many connections" errors, adjust the connection limits through either SQL commands or configuration files.
-- Increase connection limit via SQL
SET GLOBAL max_connections = 9000;
SHOW VARIABLES LIKE '%max_connections%';
SET PERSIST max_connections = 9000;
Alternatively, modify the MySQL configuration file:
# Add to /etc/mysql/my.cnf
max_connections = 9000
max_user_connection = 9000
Note: UTF8 collation beahvior - utf8_general_ci ignores case differences (case insensitive), while utf8_general_cs considers case differences (case sensitive).
GROUP BY Compatibility Issue
The ONLY_FULL_GROUP_BY SQL mode restriction can be resolved by modifying the SQL mode settings:
-- Temporarily disable ONLY_FULL_GROUP_BY
SET @@GLOBAL.sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
SET @@SESSION.sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
For permanent changes, update the configuration file:
[mysqld]
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
lower_case_table_names = 1 # 0 = case sensitive, 1 = case insensitive
For Docker deployments using official MySQL images:
docker pull mysql:8.0.31
Configuration file locations in official Docker images:
/etc/mysql/my.cnf- Main configuration with [mysqld] section/etc/mysql/conf.d/mysql.cnf- Custom configuration with [mysql] section
GROUP_CONCAT Length Restriction
The GROUP_CONCAT functon has a default length limit of 1024 characters:
SELECT GROUP_CONCAT(user_id) AS concatenated_ids FROM user_table;
Increase the limit temporarily:
SET GLOBAL group_concat_max_len = 102400;
Or permanently via configuration file:
group_concat_max_len = -1 # -1 for maximum length or specify desired length
Remember to restart MySQL after configuration changes.
Error Log Configuration
Configure error logging according to documentation at https://dev.mysql.com/doc/refman/8.0/en/error-log-priority-based-filtering.html
[mysqld]
log-error = /mysql8/error.log
log_error_verbosity = 1
Binary Log Cache Size Configuration
After adjusting binary log cache settings, disconnect and reconnect database clients for changes to take effect:
SHOW VARIABLES LIKE '%max_binlog_cache_size%';
SET GLOBAL max_binlog_cache_size = 91474836480000;