How can I connect to the embedded Labfolder database in Kubernetes?

Modified on Tue, 21 Nov, 2023 at 5:15 PM

1. Get the embedded database password of the labfolder user:


sudo kubectl get secret labfolder-labregister-chart-mysql -o jsonpath='{.data.mysql-password}' | base64 --decode

    a) Optionally, get the root password:


sudo kubectl get secret labfolder-labregister-chart-mysql -o jsonpath='{.data.mysql-root-password}' | base64 --decode


2. Connect to the MySQL POD:


sudo kubectl exec -i -t labfolder-labregister-chart-mysql-0 -c mysql -- sh -c "(bash || ash || sh)"


3. Log on to the MySQL database:


mysql --user labfolder -p

Alternatively, executing SQL queries with a single command directly from the terminal is possible. For example, this command will get all Labfolder users:


sudo kubectl exec -i -t labfolder-labregister-chart-mysql-0 -c mysql -- mysql --user labfolder -p"<my-password>" -e "select id, email, firstName, lastName from labfolder.user;"




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article