Skip to content

Commit 1d5ed8b

Browse files
committed
Ensure client run during container init uses localhost interface
The MYSQL_HOST environment variable overrides the host setting for the client if it's set, which can cause init failure, so we override it to -hlocalhost to prevent this.
1 parent 20f303d commit 1d5ed8b

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

5.5/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if [ "$1" = 'mysqld' ]; then
4040
"$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock &
4141
pid="$!"
4242

43-
mysql=( mysql --protocol=socket -uroot --socket=/var/run/mysqld/mysqld.sock)
43+
mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock)
4444

4545
for i in {30..0}; do
4646
if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then

5.6/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if [ "$1" = 'mysqld' ]; then
4040
"$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock &
4141
pid="$!"
4242

43-
mysql=( mysql --protocol=socket -uroot --socket=/var/run/mysqld/mysqld.sock)
43+
mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock)
4444

4545
for i in {30..0}; do
4646
if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then

5.7/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if [ "$1" = 'mysqld' ]; then
4040
"$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock &
4141
pid="$!"
4242

43-
mysql=( mysql --protocol=socket -uroot --socket=/var/run/mysqld/mysqld.sock)
43+
mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock)
4444

4545
for i in {30..0}; do
4646
if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then

8.0/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if [ "$1" = 'mysqld' ]; then
4040
"$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock &
4141
pid="$!"
4242

43-
mysql=( mysql --protocol=socket -uroot --socket=/var/run/mysqld/mysqld.sock)
43+
mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock)
4444

4545
for i in {30..0}; do
4646
if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then

0 commit comments

Comments
 (0)