List users in MariaDB database

Query below returns list of users in current database.

Query

select host,
       user as username,
       password,
       password_expired
from mysql.user
order by user;

Columns

  • host - user host limitation (% means all hosts)
  • username - user name
  • password - hashed password encoded with plugin
  • password_expired - indicate if password is expired

Rows

  • One row represents one user in the database
  • Scope of rows: all users in the database
  • Ordered by user name

Sample results

sample results

MySQL Workbench

You can vew database users using MySQL Workbench. In the Navigator select Users and Privileges position (1). List of users will appear in new tab (2).

ssms