【MySql】配置问题

===================================================

1、太多的连接 Too many connections

2、this is incompatible with sql_mode=only_full_group_by

3、group_concat长度限制

4、错误日志配置

===================================================

1、太多的连接 Too many connections

SQL修改

set GLOBAL max_connections = 9000;
show variables like '%max_connections%';
SET PERSIST max_connections = 9000;

 配置修改

# 在 /etc/mysql/my.cnf 中追加
max_connections = 9000
max_user_connection=9000

utf8_genera_ci 不区分大小写,ci 为 case insensitive 的缩写,即大小写不敏感。
utf8_general_cs 区分大小写, cs 为 case sensitive 的缩写,即大小写敏感

 

2、this is incompatible with sql_mode=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';

修改配置

[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的值,0代表区分,1代表不区分。

 

docker官方镜像

https://hub.docker.com/_/mysql 

docker pull mysql:8.0.31

官方镜像配置文件位置

/etc/mysql/my.cnf  配置[mysqld]

# Custom config should go here 自定义配置
/etc/mysql/conf.d/mysql.cnf 配置[mysql]

 

3、group_concat长度限制

SELECT GROUP_CONCAT(id) AS user_ids FROM users

mysql中group_concat函数对此函数的处理结果字符串长度是有限制的,默认为1024

临时修改增加长度

SET GLOBAL group_concat_max_len = 102400;  //其中数字大小可修改

在MySQL配置文件(my.ini)中加:
group_concat_max_len = -1 # -1为最大值或填入你要的最大长度
并重启mysql

 

4、错误日志配置

官方文档: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
log_error_verbosity Value Permitted Message Priorities
1 ERROR
2 ERROR, WARNING
3 ERROR, WARNING, INFORMATION

 

posted @ 2019-12-06 09:38  翠微  阅读(186)  评论(0编辑  收藏  举报