Docker搭建Mysql 8服务,提示 this is incompatible with sql

Docker搭建Mysql 8服务,提示 this is incompatible with sql,第1张

Docker搭建Mysql 8服务,提示 this is incompatible with sql

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

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/zaji/5677838.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存