Monday, February 7, 2022

[google-cloud-sql-discuss] Re: API problem SQLAdminService.Users.List

Hello,

Regarding documentation you have shared it is true that the HTTP call doesn't show the password property and it also doesn't appear if you access through the GCP console to the CLoud SQL User's section, where you can only remove or change the password.

As all you want to know is if some user has or not a password I found a possible way that you can use to retrieve this data but instead of using the GCP console, is using the shell/terminal and going into the mySQL Database following the next steps:

1. From the shell pass the next gcloud command to enter to the mySQL Database:

$ gcloud sql connect INSTANCE_ID \ --user=root

2. Once you are inside the mySQL instance and after enter your password you must enter the following query that will retrieve a list of the user names and their password hashes, if they don't have password the space will be empty:

mysql> select user, authentication_string from mysql.user;

I hope this message helps you.


On Wednesday, February 2, 2022 at 11:50:07 AM UTC+1 Eyal Maoz wrote:

Hi,
I am trying to get information about the users of a specific SQL Database Instance by using the Google.Apis.SQLAdmin api.
You can check it here where the "Try this API" part of the list documentation page.

The return value is a List of User.
This class contain some properties that remain null, no matter what I change through the GCP console.
The properties are: Password, PasswordPolicy.
Is there a reason for that? Am I missing a request parameter that will fetch this data?
Tried MySQL 5.7 and MySQL 8.0
This is the place in console where I add\change the password:
152005458-04008aa3-cb7f-46dd-8a5a-b364c8677ee2.png

The thing that I am trying to check is if the user has a password that he set for himself (it is important for Cloud SQL where you don't have to set password but it is very recommended). I don't mind what the password is so if you have any other direction that might help it would be great.
Thank you.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/df0147df-2be0-4095-a699-2a82a23af9b7n%40googlegroups.com.

No comments:

Post a Comment