Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker compose sql_mode='' is not working

when i set sql_mode='' on my mysql 8.0 container its not working . i want to change the sql mode to null because my app gives me this error

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'medix_pharma.mp_generalentry.date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

here is my docker compose file

version: '3.1'

services:
  php:
    depends_on:
      - db
    build:
      context: .
    volumes:
      - ./src:/var/www/html/
      - ./config/vhosts:/etc/apache2/sites-enabled
      - ./config/php/php.ini:/usr/local/etc/php/php.ini
    ports:
      - "80:80"
    restart: "no"
  # MySQL
  db:
    image: mysql:8.0
    container_name: mysql_host
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: medix_pharma
      MYSQL_USER: medix_pharma
      MYSQL_PASSWORD: medix_pharma
    volumes:
      - .docker/data/db:/var/lib/mysql  
    command: mysqld --sql_mode=''
    command: --default-authentication-plugin=mysql_native_password
    ports:
    - 3307:3306

  # phpMyAdmin
  phpmyadmin:
    container_name: test_phpmyadmin
    image: phpmyadmin
    environment:
    - PMA_ARBITRARY=1
    - PMA_HOSTS=mysql_host
    - PMA_USER=root
    - PMA_PASSWORD=root
    ports:
    - 8080:80
    depends_on:
    - db

i tried to set to sql mode to '' but nothing happened

like image 330
Muhammad Ibrahim Avatar asked Aug 14 '26 15:08

Muhammad Ibrahim


1 Answers

This worked for me:

command:
  - --sql_mode=
like image 119
onereal Avatar answered Aug 17 '26 23:08

onereal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!