Skip to content

Commit

Permalink
Add environment variable to skip mysqld start when only initialize data
Browse files Browse the repository at this point in the history
  • Loading branch information
AMecea authored and delgod committed Apr 17, 2019
1 parent f35ca9a commit d21dfdb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions percona-server.56/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ Do note that there is no need to use this mechanism to create the `root` superus

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 instance completely unprotected, allowing anyone to gain complete superuser access.

## `MYSQL_INIT_ONLY`

Set to `1` will skip starting the `mysqld` process and will run only the initialization part if MySQL was not initialized before.

# Notes, Tips, Gotchas

## Secure Container Startup
Expand Down
6 changes: 6 additions & 0 deletions percona-server.56/ps-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
echo 'MySQL init process done. Ready for start up.'
echo
fi

# exit when MYSQL_INIT_ONLY environment variable is set to avoid starting mysqld
if [ ! -z "$MYSQL_INIT_ONLY" ]; then
echo 'Initialization complete, now exiting!'
exit 0
fi
fi

exec "$@"
4 changes: 4 additions & 0 deletions percona-server.57/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Set to `1` to allow the container to be started with enabled TOKUDB engine.

Set to `1` to allow the container to be started with enabled ROCKSDB engine.

## `MYSQL_INIT_ONLY`

Set to `1` will skip starting the `mysqld` process and will run only the initialization part if MySQL was not initialized before.

# Notes, Tips, Gotchas

## Secure Container Startup
Expand Down
6 changes: 6 additions & 0 deletions percona-server.57/ps-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
echo 'MySQL init process done. Ready for start up.'
echo
fi

# exit when MYSQL_INIT_ONLY environment variable is set to avoid starting mysqld
if [ ! -z "$MYSQL_INIT_ONLY" ]; then
echo 'Initialization complete, now exiting!'
exit 0
fi
fi

exec "$@"
4 changes: 4 additions & 0 deletions percona-server.80/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Set to `1` to allow the container to be started with enabled TOKUDB engine.

Set to `1` to allow the container to be started with enabled ROCKSDB engine.

## `MYSQL_INIT_ONLY`

Set to `1` will skip starting the `mysqld` process and will run only the initialization part if MySQL was not initialized before.

# Notes, Tips, Gotchas

## Secure Container Startup
Expand Down
6 changes: 6 additions & 0 deletions percona-server.80/ps-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
echo 'MySQL init process done. Ready for start up.'
echo
fi

# exit when MYSQL_INIT_ONLY environment variable is set to avoid starting mysqld
if [ ! -z "$MYSQL_INIT_ONLY" ]; then
echo 'Initialization complete, now exiting!'
exit 0
fi
fi

exec "$@"

0 comments on commit d21dfdb

Please sign in to comment.