↑ ↓ select, Enter open, Esc close

Show the privileges of a MySQL user

Adjust the values, the command updates live
root@server
mysql -e "SHOW GRANTS FOR 'dbuser'@'localhost';"

Prints the user’s privileges as GRANT statements. Useful with the error message “Access denied” to check whether the user has access to the right database. User and host must exactly match an entry in mysql.user.

Also searched as

  • check mysql user privileges
  • access denied for user database
  • what permissions does database user have

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.