Databases · MariaDB / MySQL
MySQL Users and Privileges
Cheat sheet · https://pcornel.dk/topic.php?topic=6177
Answer
MySQL/MariaDB users are identified as 'user'@'host' and granted privileges at global, database, table or column level.
Remember
The host part matters — 'app'@'%' and 'app'@'localhost' are different accounts. Grant least privilege to app users; no SUPER/ALL for apps.
First checks
SELECT user,host FROM mysql.user;— first check for this topicpsql -c "SELECT now(), version();"— PostgreSQL reachable and versionmysql -e "SELECT NOW(), VERSION();"— MariaDB/MySQL reachable and versionsqlcmd -S <server> -Q "SELECT @@VERSION"— SQL Server reachable and version
Verify in this order
client user + host → account matched → password/plugin → grants
Where it usually breaks
An anonymous account (''@localhost) can match before your user.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6177