Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update socket location for mysql clients #830

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 5.7/Dockerfile.oracle

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions 5.7/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.0/Dockerfile.oracle

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions 8.0/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions template/Dockerfile.oracle
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ RUN set -eux; \
grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \
sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \
grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \
{ echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \
\
# make sure users dumping files in "/etc/mysql/conf.d" still works
! grep -F '!includedir' /etc/my.cnf; \
Expand Down
15 changes: 15 additions & 0 deletions template/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ mysql_get_config() {
# match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)"
}

# Ensure that the package default socket can also be used
# since rpm packages are compiled with a different socket location
# and "mysqlsh --mysql" doesn't read the [client] config
# related to https://github.com/docker-library/mysql/issues/829
mysql_socket_fix() {
local defaultSocket
defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)"
if [ "$defaultSocket" != "$SOCKET" ]; then
ln -sfTv "$SOCKET" "$defaultSocket" || :
fi
}

# Do a temporary startup of the MySQL server, for init purposes
docker_temp_server_start() {
if [ "${MYSQL_MAJOR}" = '5.7' ]; then
Expand Down Expand Up @@ -366,6 +378,7 @@ _main() {
docker_temp_server_start "$@"
mysql_note "Temporary server started."

mysql_socket_fix
docker_setup_db
docker_process_init_files /docker-entrypoint-initdb.d/*

Expand All @@ -378,6 +391,8 @@ _main() {
echo
mysql_note "MySQL init process done. Ready for start up."
echo
else
mysql_socket_fix
fi
fi
exec "$@"
Expand Down