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

Refactor MariaDB root password setting #2738

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
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
Next Next commit
Refactor MariaDB root password setting
It looks like newer versions of Mariadb need a different method for doing this, also we weren't shutting it down and running in the right mode to set the new password
tomjn authored Oct 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit c2b1de2394afaaa05db410d83698e3821186c87b
9 changes: 7 additions & 2 deletions provision/core/mariadb/provision.sh
Original file line number Diff line number Diff line change
@@ -87,17 +87,22 @@ SQL
fi
# Do reset password in safemode
vvv_warn " * The root password is not root, fixing"
systemctl stop mariadb
mysqld_safe --skip-grant-tables --skip-networking &
sql=$( cat <<-SQL
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password USING PASSWORD('root');
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
FLUSH PRIVILEGES;
SQL
)
mysql -u root -proot -e "${sql}"
mysql -u root -e "${sql}"
if [[ $? -eq 0 ]]; then
vvv_success " - root user password should now be root"
else
vvv_warn " - could not reset root password"
fi
sudo kill '/var/run/mariadb/mariadb.pid'
vvv_info " - restarting mariadb"
sudo systemctl start mariadb
}

function mysql_setup() {