Query database accounts
Updated at:
Copy as MD
AnalyticDB for MySQL is compatible with MySQL databases. It stores database account and permission information in a built-in database named mysql. Run a SELECT statement against the mysql.user table to list all database accounts in your cluster.
Required permissions
Only a privileged account can query database account information. A privileged account in AnalyticDB for MySQL is equivalent to a root account in MySQL.
Query database accounts
Run the following statement to retrieve all database accounts, their allowed hosts, and hashed passwords:
USE MYSQL;
SELECT User, Host, Password FROM mysql.user;The output looks similar to the following:
+---------+-----+--------------------------+
| User | Host| Password |
+---------+-----+--------------------------+
| account1| % | *61f3777f02386598cd***** |
| account2| % | *0fe79c07e168cabc99***** |The output contains the following columns:
| Column | Description |
|---|---|
User | The database account name. |
Host | The host from which the account is allowed to connect. % means the account can connect from any host. |
Password | The hashed password. AnalyticDB for MySQL partially masks the value with asterisks. |
Is this page helpful?