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 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
14 changes: 11 additions & 3 deletions provision/core/mariadb/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,25 @@ 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 &
# give the safemode server a chance to start,
sleep 1
sql=$( cat <<-SQL
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password USING PASSWORD('root');
FLUSH PRIVILEGES;
FLUSH PRIVILEGES;
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() {
Expand Down
Loading