Merge ~valentinviennot/ubuntu-docker-images:update-mysql-readme into ~ubuntu-docker-images/ubuntu-docker-images/+git/mysql:edge

Proposed by Valentin Viennot
Status: Merged
Merged at revision: 5da174f0239d89e4fa6037e082bef85e163f1ba7
Proposed branch: ~valentinviennot/ubuntu-docker-images:update-mysql-readme
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/mysql:edge
Diff against target: 85 lines (+15/-26)
1 file modified
README.md (+15/-26)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior Needs Fixing
Richard Harding Pending
Review via email: mp+393879@code.launchpad.net

Description of the change

Did some cleaning work and consistency against the last version of the Redis README.

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the MP. There's just one very small nit, but otherwise everything is great. Let me know when you address it and I can merge your branch.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/README.md b/README.md
index 490268e..46a6f2d 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
5MySQL is a fast, stable and true multi-user, multi-threaded SQL database5MySQL is a fast, stable and true multi-user, multi-threaded SQL database
6server. SQL (Structured Query Language) is the most popular database query6server. SQL (Structured Query Language) is the most popular database query
7language in the world. The main goals of MySQL are speed, robustness and ease7language in the world. The main goals of MySQL are speed, robustness and ease
8of use.8of use. Read more on the [MySQL website](https://dev.mysql.com/doc/refman/8.0/en/).
99
10## Tags10## Tags
1111
@@ -20,34 +20,26 @@ of use.
20### Docker CLI20### Docker CLI
2121
22```sh22```sh
23$ docker network create mysql-net23$ docker network create --driver bridge mysql-net
24# Run the server24$ docker run -d --name mysql-instance --network mysql-net -e TZ=Europe/London -e MYSQL_ROOT_PASSWORD=My:S3cr3t/ squeakywheel/mysql:edge
25$ docker run --name mysql-instance --network mysql-net --env MYSQL_ROOT_PASSWORD=My$seCret --detach squeakywheel/mysql:edge
26# Run the client
27$ docker run --interactive --tty --rm --network mysql-net squeakywheel/mysql:edge mysql -hmysql-instance -Uroot -p
28```
29
30The password will be asked and you can enter `My$seCret`. Now, you are logged in and can enjoy your new instance.
31
32Since containers are ephemeral you might be interested in persist data and not initialize a new database every time you launch a new container. To do that you can use docker volumes:
33
34```sh
35$ docker run --name mysql --volume /path/to/persisted/data:/var/lib/mysql --env MYSQL_RANDOM_ROOT_PASSWORD=yes squeakywheel/mysql:edge
36```25```
3726
38#### Parameters27#### Parameters
3928
40| Parameter | Description |29| Parameter | Description |
41|---|---|30|---|---|
42| `-e TZ=UTC` | Timezone |31| `-e TZ=UTC` | Timezone. |
43| `-e MYSQL_ROOT_PASSWORD=secret_for_root` | Set the password for the `root` user. This option is **mandatory** and **must not be empty**. |32| `-e MYSQL_ROOT_PASSWORD=secret_for_root` | Set the password for the `root` user. This option is **mandatory** and **must not be empty**. |
44| `-e MYSQL_PASSWORD=secret` | Set the password for the `MYSQL_USER` user. |33| `-e MYSQL_PASSWORD=secret` | Set the password for the `MYSQL_USER` user. |
45| `-e MYSQL_USER=john` | Create a new user with superuser privileges. This is used in conjunction with `MYSQL_PASSWORD` |34| `-e MYSQL_USER=john` | Create a new user with superuser privileges. This is used in conjunction with `MYSQL_PASSWORD`. |
46| `-e MYSQL_DATABASE=db_test` | Set the name of the default database. |35| `-e MYSQL_DATABASE=db_test` | Set the name of the default database. |
47| `-e MYSQL_ALLOW_EMPTY_PASSWORD=yes` | Set up a blank password for the `root` user. **This is not recommended to be used in production, make sure you know what you are doing**. |36| `-e MYSQL_ALLOW_EMPTY_PASSWORD=yes` | Set up a blank password for the `root` user. **This is not recommended to be used in production, make sure you know what you are doing**. |
48| `-e MYSQL_RANDOM_ROOT_PASSWORD=yes` | Generate a random initial password for the `root` user using `pwgen`. It will be printed in the logs, search for `GENERATED ROOT PASSWORD`. |37| `-e MYSQL_RANDOM_ROOT_PASSWORD=yes` | Generate a random initial password for the `root` user using `pwgen`. It will be printed in the logs, search for `GENERATED ROOT PASSWORD`. |
49| `-e MYSQL_ONETIME_PASSWORD=yes` | Set `root` user as experide once initialization is complete, forcing a password change on first login. |38| `-e MYSQL_ONETIME_PASSWORD=yes` | Set `root` user as experide once initialization is complete, forcing a password change on first login. |
50| `-e MYSQL_INITSB_SKIP_TZINFO=yes` | Timezone data is automatically loaded via entrypoint script, set this variable to any non-empty value to disable it. | 39| `-e MYSQL_INITSB_SKIP_TZINFO=yes` | Timezone data is automatically loaded via entrypoint script, set this variable to any non-empty value to disable it. |
40| `-p 30306:3306` | Expose MySQL server on `localhost:30306`. |
41| `-v /path/to/data:/var/lib/mysql` | Persist data instead of initializing a new database every time you launch a new container |
42| `-v /path/to/config/files/:/etc/mysql/mysql.conf.d/` | Pass your own [configuration files](https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html) to the container. |
5143
52#### Initialization Scripts44#### Initialization Scripts
5345
@@ -59,23 +51,20 @@ One can also add initialization scripts to their containers. This includes `*.sq
5951
60All of this is done before the MySQL service is started. Keep in mind if your database directory is not empty (contains pre-existing database) they will be left untouched.52All of this is done before the MySQL service is started. Keep in mind if your database directory is not empty (contains pre-existing database) they will be left untouched.
6153
62#### Database Configuration54#### Testing/Debugging
6355
64You can pass your own configuration files to the container doing the following:56In case you need to debug what it is happening with the container you can run `docker logs <name_of_the_container>`. But if you want to get access to an interactive shell run:
6557
66```sh58```sh
67$ docker run --name mysql --volume /path/to/mysql/config/files/:/etc/mysql/mysql.conf.d/ --env MYSQL_ROOT_PASSWORD=P@sSwd squeakywheel/mysql:edge59$ docker exec -it <name_of_the_container> /bin/bash
68```60```
6961
70#### Debugging62With this same image, you can launch an interactive container as a client to connect to your `mysql` server running in the first container.
71
72In case you need to debug what it is happening with the container you can run `docker logs <name_of_the_container>`. But if you want to get access to an interactive shell run:
7363
74```sh64```sh
75$ docker exec -it <name_of_the_container> /bin/bash65$ docker run -it --rm --network mysql-net squeakywheel/mysql:edge mysql -hmysql-instance -uroot -p
76```66```
7767The password will be asked and you can enter `My:S3cr3t/`. Now, you are logged in and can enjoy your new instance.
78To see how to use the MySQL OCI image with `docker-compose` and `kubernetes` check the `examples/README.md` file.
7968
80## Deploy with Kubernetes69## Deploy with Kubernetes
8170

Subscribers

People subscribed via source and target branches