linux服务上用docker安装的mysql出现错误提示:
mysql 执行报错:
Error querying database. Cause: java.sql.SQLSyntaxErrorException:which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
可以做如下处理:
1、docker run启动的方式
$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
2、docker-compose的方式编排的方式:
mysql:
image: mysql:8.0.26
container_name: mysql
privileged: true
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --explicit_defaults_for_timestamp=true --lower_case_table_names=1 --max_allowed_packet=128M --sql-mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
restart: always
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: xxxx
env_file:
- /app/mysql/env/xx.env
ports:
- "3306:3306"
volumes:
- /app/mysql/custom:/etc/mysql/conf.d
- /app/mysql/data:/var/lib/mysql
networks:
- xxx