Skip to content

Instantly share code, notes, and snippets.

@serafdev
Created November 19, 2024 01:13
Show Gist options
  • Save serafdev/59341a1f04acda0f7df4f301830c2f85 to your computer and use it in GitHub Desktop.
Save serafdev/59341a1f04acda0f7df4f301830c2f85 to your computer and use it in GitHub Desktop.
Reset the root password for the bitnami deployed mariadb, description in the GIST itself

What??

FIX YOUR MARIADB ROOT PASSWORD

Why??

Because you don't want it broken.

OK

I keep going back to this comment as all bitnami's helm charts have an issue when using ArgoCD with the default username/password for MariaDB where the secret is re-generated everytime.

The correct solution is to use "existingSecret" in the values.yaml OR a secret for an external database.

What I do now since I do not have crazy traffic is to have 1 MariaDB in my Kubernetes Cluster and create a user and a database for each application that uses MariaDB, make sure to give the correct scope for each user.

In any case here's the solution for the default behaviour:

Solution from @lknite in this comment: bitnami/charts#10439 (comment)

Solution

For someone who comes across this later, I was able to get things back up and working by:

edit the mariadb statefulset

kubectl edit statefulset wordpress-<website>-mariadb & setting a command to run: set a command to be run instead of the default from the container

        - /opt/bitnami/mariadb/bin/mysqld_safe
        - --skip-grant-tables
        - --skip-networking
        - --datadir=/bitnami/mariadb/data

now reset the root@% password

k exec -it wordpress-<website>-mariadb-0 -- bash
mysql -u root
> use mysql;
> FLUSH PRIVILEGES;
> ALTER USER 'root'@'%' IDENTIFIED BY '<password to use from your secret>';

modify the statefulset to remove the command added earlier & kill the pod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment