From 99f35c55c62254f63e27876b24d130400ceebd1a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 20 Apr 2016 16:49:13 -0700 Subject: [PATCH 1/2] Note an easy way to run "mysqldump" --- mysql/content.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mysql/content.md b/mysql/content.md index d65a11906..af5d80f77 100644 --- a/mysql/content.md +++ b/mysql/content.md @@ -143,3 +143,11 @@ If there is no database initialized when the container starts, then a default da ## Usage against an existing database If you start your `%%REPO%%` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. + +## Creating database dumps + +Most of the normal tools will work, although their usage might be a little convoluted in some cases to ensure they have access to the `mysqld` server. A simple way to ensure this is to use `docker exec` and run the tool from the same container, similar to the following: + +```console +$ docker exec some-%%REPO%% sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/all-databases.sql +``` From 7557631a9ec15f041f257a5ed7bf6b1dd4810d21 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 25 Apr 2016 11:43:14 -0700 Subject: [PATCH 2/2] Replicate "mysql/content.md" note about "mysqldump" to mariadb and percona --- mariadb/content.md | 8 ++++++++ percona/content.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/mariadb/content.md b/mariadb/content.md index 2c660d188..a4feba342 100644 --- a/mariadb/content.md +++ b/mariadb/content.md @@ -145,3 +145,11 @@ If there is no database initialized when the container starts, then a default da ## Usage against an existing database If you start your `%%REPO%%` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. + +## Creating database dumps + +Most of the normal tools will work, although their usage might be a little convoluted in some cases to ensure they have access to the `mysqld` server. A simple way to ensure this is to use `docker exec` and run the tool from the same container, similar to the following: + +```console +$ docker exec some-%%REPO%% sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/all-databases.sql +``` diff --git a/percona/content.md b/percona/content.md index 383e68a0b..f8c5e92e1 100644 --- a/percona/content.md +++ b/percona/content.md @@ -145,3 +145,11 @@ If there is no database initialized when the container starts, then a default da ## Usage against an existing database If you start your `%%REPO%%` container instance with a data directory that already contains a database (specifically, a `mysql` subdirectory), the `$MYSQL_ROOT_PASSWORD` variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way. + +## Creating database dumps + +Most of the normal tools will work, although their usage might be a little convoluted in some cases to ensure they have access to the `mysqld` server. A simple way to ensure this is to use `docker exec` and run the tool from the same container, similar to the following: + +```console +$ docker exec some-%%REPO%% sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/all-databases.sql +```