From 12371a0c4ded41cfb4e3d4db97cc198d8fac3995 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Tue, 22 Nov 2016 14:37:16 +0100 Subject: [PATCH] Hardcode socket path for temporary init runs of server and client During container init, we start both server and client temporarily, for user admin etc. For the server we pass on any command line arguments specified by the user, but for the client we don't. This can cause an issue if the user specifies a different socket path, since the client won't find it, causing init failure. Since the socket location doesn't really matter for these temporary runs, we hardcode it to /var/run/mysqld/mysqld.sock Fixes issue #238 --- 5.5/docker-entrypoint.sh | 4 ++-- 5.6/docker-entrypoint.sh | 4 ++-- 5.7/docker-entrypoint.sh | 4 ++-- 8.0/docker-entrypoint.sh | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh index 29257bfdc..542543643 100755 --- a/5.5/docker-entrypoint.sh +++ b/5.5/docker-entrypoint.sh @@ -64,10 +64,10 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then mysql_install_db --datadir="$DATADIR" --rpm --basedir=/usr/local/mysql echo 'Database initialized' - "$@" --skip-networking --basedir=/usr/local/mysql & + "$@" --skip-networking --basedir=/usr/local/mysql --socket=/var/run/mysqld/mysqld.sock & pid="$!" - mysql=( mysql --protocol=socket -uroot -hlocalhost) + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock) for i in {30..0}; do if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index a0c0e83d4..109037f9b 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -64,10 +64,10 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf echo 'Database initialized' - "$@" --skip-networking & + "$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock & pid="$!" - mysql=( mysql --protocol=socket -uroot -hlocalhost) + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock) for i in {30..0}; do if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 9a8e81977..760935e39 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -64,10 +64,10 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then "$@" --initialize-insecure echo 'Database initialized' - "$@" --skip-networking & + "$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock & pid="$!" - mysql=( mysql --protocol=socket -uroot -hlocalhost) + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock) for i in {30..0}; do if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 9a8e81977..760935e39 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -64,10 +64,10 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then "$@" --initialize-insecure echo 'Database initialized' - "$@" --skip-networking & + "$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock & pid="$!" - mysql=( mysql --protocol=socket -uroot -hlocalhost) + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock) for i in {30..0}; do if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then