From 76021cbc88b05ec44b17c80146cbbe156178e733 Mon Sep 17 00:00:00 2001 From: Felix Schneider Date: Wed, 27 Mar 2024 22:41:23 +0100 Subject: [PATCH 1/2] Pass command line arguments to mysql commands --- src/modules/services/mysql.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/modules/services/mysql.nix b/src/modules/services/mysql.nix index b6547408c..552bb4a55 100644 --- a/src/modules/services/mysql.nix +++ b/src/modules/services/mysql.nix @@ -293,11 +293,17 @@ in MYSQL_TCP_PORT = toString cfg.settings.mysqld.port; }); - scripts.mysql.exec = "${mysqlWrapped}/bin/mysql"; + scripts.mysql.exec = '' + ${mysqlWrapped}/bin/mysql "$@" + ''; - scripts.mysqladmin.exec = "${mysqladminWrapped}/bin/mysqladmin"; + scripts.mysqladmin.exec = '' + ${mysqladminWrapped}/bin/mysqladmin "$@" + ''; - scripts.mysqldump.exec = "${mysqldumpWrapped}/bin/mysqldump"; + scripts.mysqldump.exec = '' + ${mysqldumpWrapped}/bin/mysqldump "$@" + ''; processes.mysql.exec = "${startScript}/bin/start-mysql"; processes.mysql-configure.exec = "${configureScript}/bin/configure-mysql"; From 6c88af555a46ad7340976f116a856482d1feb514 Mon Sep 17 00:00:00 2001 From: Felix Schneider Date: Thu, 28 Mar 2024 00:04:45 +0100 Subject: [PATCH 2/2] Add tests for mysql scripts and fix existing test script --- tests/mysql/.test.sh | 10 +++++++++- tests/mysql/devenv.nix | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/mysql/.test.sh b/tests/mysql/.test.sh index 29693a293..3717109e5 100755 --- a/tests/mysql/.test.sh +++ b/tests/mysql/.test.sh @@ -1,6 +1,14 @@ +set -e + wait_for_port 3306 + +# Wait for configure-mysql to finish. +sleep 5 + # through unix_socket mysql -e 'SELECT VERSION()' # through tcp/ip -mysql -h 127.0.0.1 -udb -pdb -e 'SELECT VERSION()' +mysql -h "127.0.0.1" -udb -pdb -e 'SELECT VERSION()' + +ping-mysql diff --git a/tests/mysql/devenv.nix b/tests/mysql/devenv.nix index 3c2e4bbe9..0ca449eb7 100644 --- a/tests/mysql/devenv.nix +++ b/tests/mysql/devenv.nix @@ -16,4 +16,8 @@ }; }; }; + + scripts.ping-mysql.exec = '' + $DEVENV_PROFILE/bin/mysqladmin ping + ''; }