Mysql: Option to set modes

Created on 23 Oct 2015  路  6Comments  路  Source: docker-library/mysql

I didn't find any way to set mysql modes.

Could be nice to have a env option like this:

MYSQL_MODES="STRICT_TRANS_TABLES"
MYSQL_MODES_EMPTY="1" # Clean all modes

Ref: https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html

Most helpful comment

For anyone coming accross this thread in search of an answer to the question how to change the SQL modes for a mysql container when using composer, be aware that there is a typo in ltangvald's answer. The correct flag is called --sql-mode, not --sql-modes.

Accordingly, in the compose file, just add a new line like this:

command: --sql-mode="modes"

_modes_ can be any number of modes, or an empty string if you want to remove all modes.

All 6 comments

Any server options can be passed to the image by appending them to the end of the command.
You can start the image with

docker run [...] -d mysql --sql-modes="modes"

Is that what you were looking for?

Well, I use Docker for GitLabCI and I don't think it's possible: http://doc.gitlab.com/ci/yaml/README.html

As you can see, you can pass variables for option, but no way to do like you said.

Great that users can pass in the --sql-modes flag. What is the equivalent for docker-compose files?

@djcf https://docs.docker.com/v1.7/compose/yml/#command
I think this answers the question.

Closing given that this is currently trivially possible via a custom command or even a custom config file included in the running container (or a derivative image) -- any issues with GitLab CI not allowing a custom command to be specified should be filed with them (this is a standard Docker feature supported with Docker, Compose, Swarm Services, and even k8s, and is part of the standard interface between users and Docker images).

Thanks, and sorry!

For anyone coming accross this thread in search of an answer to the question how to change the SQL modes for a mysql container when using composer, be aware that there is a typo in ltangvald's answer. The correct flag is called --sql-mode, not --sql-modes.

Accordingly, in the compose file, just add a new line like this:

command: --sql-mode="modes"

_modes_ can be any number of modes, or an empty string if you want to remove all modes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomnewport picture tomnewport  路  3Comments

jicki picture jicki  路  3Comments

mcandre picture mcandre  路  4Comments

odero picture odero  路  3Comments

seangerhardt-wf picture seangerhardt-wf  路  4Comments