Skip to content

Commit 20f303d

Browse files
committed
Hardcode socket path during init
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
1 parent 056bce0 commit 20f303d

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

5.5/docker-entrypoint.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ if [ "$1" = 'mysqld' ]; then
3737
mysql_install_db --user=mysql --datadir="$DATADIR" --rpm
3838
echo 'Finished mysql_install_db'
3939

40-
"$@" --skip-networking &
40+
"$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock &
4141
pid="$!"
4242

43-
mysql=( mysql --protocol=socket -uroot )
43+
mysql=( mysql --protocol=socket -uroot --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

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ if [ "$1" = 'mysqld' ]; then
3737
mysql_install_db --user=mysql --datadir="$DATADIR" --rpm --keep-my-cnf
3838
echo 'Finished mysql_install_db'
3939

40-
"$@" --skip-networking &
40+
"$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock &
4141
pid="$!"
4242

43-
mysql=( mysql --protocol=socket -uroot )
43+
mysql=( mysql --protocol=socket -uroot --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

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ if [ "$1" = 'mysqld' ]; then
3737
"$@" --initialize-insecure=on
3838
echo 'Database initialized'
3939

40-
"$@" --skip-networking &
40+
"$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock &
4141
pid="$!"
4242

43-
mysql=( mysql --protocol=socket -uroot )
43+
mysql=( mysql --protocol=socket -uroot --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

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ if [ "$1" = 'mysqld' ]; then
3737
"$@" --initialize-insecure=on
3838
echo 'Database initialized'
3939

40-
"$@" --skip-networking &
40+
"$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock &
4141
pid="$!"
4242

43-
mysql=( mysql --protocol=socket -uroot )
43+
mysql=( mysql --protocol=socket -uroot --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)