How to change the password for MySQL root user in GCP CloudSQL DB instance with private IP address . I am able to change the password using the below command from Cloud Shell with Public IP
gcloud sql users set-password root --instance=testdb --prompt-for-password
but it does not work for instances with Private IP address .
I can use the GCP Console to change the password but the root user is not listed under Users TAB
Console--> CloudSQL--> DB Instance --> Users
Other option seems installing gcloud on a VM in the same network as CloudSQL and change it using below command
gcloud sql users set-password root --instance=testdb --prompt-for-password
Any other suggestion to change password for root user in a MySQL private DB instance . I need to change the password as initially the DB was created skipping the password.
Also is it more secure to use --host=%
option while changing the password with gcloud command.
gcloud sql users set-password root --host=% --instance=testdb --prompt-for-password
I tested the command and I was not able to update the password not even in a Cloud SQL instance with public IP (and I did a lot of tests for example running the command from a VM). I raised a Public Issue Tracker mentioning this issue. I recommend you add a +1 in order that the engineering team this issue into consideration and this one be resolved :)