Import alt-mysql plugin

This commit is contained in:
Marek Miklewicz
2026-07-04 15:48:19 +02:00
commit d71fcf9ace
101 changed files with 18635 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck source=./mysql_common.sh
source "$SCRIPT_DIR/mysql_common.sh"
fail() {
echo "alt-mysql health: $*" >&2
exit 1
}
mysql_load_alt_runtime
mysql_load_alt_credentials
if command -v systemctl >/dev/null 2>&1; then
systemctl is-active --quiet "$MYSQL_ALT_SERVICE_NAME" || fail "service is not active: $MYSQL_ALT_SERVICE_NAME"
fi
[ -r "$MYSQL_ALT_MY_CNF" ] || fail "client defaults file is not readable: $MYSQL_ALT_MY_CNF"
[ -r "$MYSQL_ALT_MYSQL_CONF" ] || fail "credentials file is not readable: $MYSQL_ALT_MYSQL_CONF"
[ -n "$MYSQL_ALT_PORT" ] || fail "alt port was not discovered"
[ -n "$MYSQL_ALT_SOCKET" ] || fail "alt socket was not discovered"
"$(mysql_alt_binary mysql)" --defaults-extra-file="$MYSQL_ALT_MY_CNF" -e "SELECT 1" >/dev/null \
|| fail "cannot connect through $MYSQL_ALT_MY_CNF"
mysql_ensure_metadata_schema
mysql_exec mysql -e "SELECT COUNT(*) FROM da_plugin_database_owners" >/dev/null \
|| fail "metadata schema is not usable"
echo "alt-mysql health: OK"