↑ ↓ select, Enter open, Esc close

List all MySQL users with their host

root@server
mysql -e 'SELECT user, host FROM mysql.user ORDER BY user;'

Lists all accounts from the user table with their allowed host. Entries with host % can connect from anywhere and should be set deliberately. Useful for security audits and for cleaning up orphaned users.

Note: On Plesk servers, manage users through the Plesk interface whenever possible.

Also searched as

  • show mysql users
  • list database users
  • mariadb user list

Related one-liners

All in MySQL and MariaDB

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.