Skip to content

Instantly share code, notes, and snippets.

@AmreeshTyagi
Last active January 24, 2019 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmreeshTyagi/ca87183d29fa3217b7487ceb17c275f4 to your computer and use it in GitHub Desktop.
Save AmreeshTyagi/ca87183d29fa3217b7487ceb17c275f4 to your computer and use it in GitHub Desktop.
mysql 8.0 caching_sha2_password fix for kubernetes
#!/bin/bash
# Please change values of <> placeholders as per your requirments.
# Step 1: Get mysql password from kubernetes pod, if installed from helm.
MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace <my-namespace> <mysql-secret-key> -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo)
# Step 2: Run mysql client in kubernetes
kubectl run -it --rm --image=mysql:8.0 --restart=Never mysql-client -- mysql -h <mysql-host> -u root -p$MYSQL_ROOT_PASSWORD
# Step 3: Run following query to chnage password method
# ALTER USER 'yourusername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment