I want to launch MySQL local instance with docker image usage.
So far my docker-compose.yml
file looks like:
version: '3.3'
services:
db:
image: mysql:8
command: --default-authentication-plugin=mysql_native_password
volumes:
- ./mysql-dump:/docker-entrypoint-initdb.d
restart: always
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: sqlPractice
MYSQL_USER: admin
MYSQL_PASSWORD: admin
ports:
- '7142:3306'
security_opt:
- seccomp:unconfined
Till this moment everything works. My database is supplied with data but after one query execution like:
SELECT DISTINCT surname, name, data FROM exams e JOIN students s ON e.`id-student` = s.`id-student` WHERE passed='Y' AND (data, `id-centre`) = (SELECT MIN(data), e.`id-centre` FROM exams e JOIN centers c ON e.`id-center` = c.`id-center` WHERE e.passed='Y' AND c.`center-name` = 'IT Institute')
I am receiving an error like:
ER_MIX_OF_GROUP_FUNC_AND_FIELDS: In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated column 'sqlPractice.e.id-center'; this is incompatible with sql_mode=only_full_group_by
According to this post:
click
I want to set a param sql_mode
in my docker-compose.yml
because allegedly this will solve a problem.
My docker-compose.yml
with two params in command flag looks like:
version: '3.3'
services:
db:
image: mysql:8
command:
- default-authentication-plugin=mysql_native_password
- sql_mode=""
volumes:
- ./mysql-dump:/docker-entrypoint-initdb.d
restart: always
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: sqlPractice
MYSQL_USER: admin
MYSQL_PASSWORD: admin
ports:
- '7142:3306'
security_opt:
- seccomp:unconfined
but after all I am receiving error while launching
db_1 | /usr/local/bin/docker-entrypoint.sh: line 363: exec: default-authentication-plugin=mysql_native_password: not found
and after all container is not working properly.
All I want to achieve is configure MySQL instance via docker-compose.yml
with these two parameters in command
param in docker-compose.yml
to make my Query works as it supposes.
I will be grateful for suggestions on how to reach a goal.