-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add encoding hints for mysql, mariadb, and percona #502
Conversation
Example setting character set and collation for the server: $ docker run -d --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_DATABASE=testing mysql --character-set-server=utf8 --collation-server=utf8_unicode_ci
$ docker run -it --link mysql:mysql --rm mysql mysql -hmysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.11 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SELECT schema_name, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM INFORMATION_SCHEMA.SCHEMATA;
+--------------------+----------------------------+------------------------+
| schema_name | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME |
+--------------------+----------------------------+------------------------+
| information_schema | utf8 | utf8_general_ci |
| mysql | utf8 | utf8_unicode_ci |
| performance_schema | utf8 | utf8_general_ci |
| sys | utf8 | utf8_general_ci |
| testing | utf8 | utf8_unicode_ci |
+--------------------+----------------------------+------------------------+
5 rows in set (0.00 sec)
mysql> ^DBye |
@@ -72,6 +72,20 @@ Note that users on host systems with SELinux enabled may see issues with this. T | |||
$ chcon -Rt svirt_sandbox_file_t /my/custom | |||
``` | |||
|
|||
### Configuration without a `cnf` file | |||
|
|||
Many configuration options can be passed as flags to `mysqld`. This will give you the flexibility to customize the container without needing a `cnf` file. For example, if you want to change the default encoding and collation for all tables to use `utf8` just run the following: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should change "utf8
" to "UTF-8 (utf8mb4
)" and update the example below so that we're recommending "real" UTF-8, not the broken 3-byte version 😄
LGTM otherwise, pending those |
Updated! |
Now waiting on docker-library/official-images#1533 -- once that merges, we're good to go here. |
docker-library/official-images#1533 merged; will merge once they are built and pushed to the hub. |
Add encoding hints for mysql, mariadb, and percona
Needs docker-library/mysql#147, docker-library/percona#15, MariaDB/mariadb-docker#45 for end user clarity when using
--help
.Fixes docker-library/mysql#14
(replaces) Fixes #237