Skip to content

Commit e28da83

Browse files
committed
Updated readme file for MYSQL_ROOT_HOST setting
1 parent 6fbb227 commit e28da83

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ This image exposes the standard MySQL port (3306), so container linking makes th
3737

3838
## Connect to MySQL from the MySQL Command Line Client
3939

40-
The following command starts another MySQL container instance and runs the `mysql` command line client against your original MySQL container, allowing you to execute SQL statements against your database:
40+
The following command starts a new process inside an existing MySQL container instance and runs the `mysql` command line client against your original MySQL server, allowing you to execute SQL statements against your database:
4141

42-
docker run -it --link my-container-name:mysql --rm mysql/mysql-server:tag sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
42+
docker exec -it my-container-name mysql -uroot -p
4343

44-
... where `my-container-name` is the name of your original MySQL Server container.
44+
... where `my-container-name` is the name of your original MySQL Server container. Note that if the main container process (the server) exits, the process started by exec will also exit.
4545

4646
More information about the MySQL command line client can be found in the MySQL reference documentation at http://dev.mysql.com/doc/refman/en/
4747

@@ -89,6 +89,10 @@ Do note that there is no need to use this mechanism to create the `root` superus
8989

9090
Set to `yes` to allow the container to be started with a blank password for the root user. **NOTE:** Setting this variable to `yes` is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access.
9191

92+
## `MYSQL_ROOT_HOST`
93+
94+
By default, MySQL creates the 'root'@'localhost' command. This account can only be connected to from inside the container, requiring the use of the docker exec command as noted under `Connect to MySQL from the MySQL Command Line Client`. To allow connections from other hosts, set this environment variable. As an example, the value "172.17.0.1", which is the default Docker gateway IP, will allow connections from the Docker host machine.
95+
9296
# Notes, Tips, Gotchas
9397

9498
## Secure Container Startup

0 commit comments

Comments
 (0)