Skip to content

Instantly share code, notes, and snippets.

View soulseekah's full-sized avatar
🦁
rAwr();

Gennady Kovshenin soulseekah

🦁
rAwr();
View GitHub Profile
@soulseekah
soulseekah / maria-unlock.sh
Created January 5, 2024 10:51
Reset root password script for mariadb docker image (docker compose)
#!/bin/bash
COMMAND="echo \"*** Starting unlock procedure...\";"
COMMAND="$COMMAND /usr/sbin/mariadbd --verbose --user=root --skip-grant-tables 2>/tmp/mariadbd.err &"
COMMAND="$COMMAND echo -n \"*** Waiting for database connection\";"
COMMAND="$COMMAND until mariadb -e 'SELECT 1' 2>/tmp/mariadb.err 1>/tmp/mariadb.err; do echo -n '.'; done; echo;"
COMMAND="$COMMAND echo '*** Connected! Setting root password to: $1';"
COMMAND="$COMMAND mariadb -e \"FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY '$1'; SHUTDOWN;\" &"