Access denied for user '...'@'...'

Adminer Login Failed Access Denied: 3 Causes & Fixes

Database Errors Intermediate 👁 6 views 📅 Jun 15, 2026

Adminer throws "Access denied" when credentials are wrong, the user lacks host permissions, or MySQL auth plugin mismatches. Here's how to fix each.

1. Wrong credentials (the most common cause)

You'd think this is obvious, but I've tripped on it more times than I'll admit. Adminer shows "Access denied for user 'username'@'localhost'" when either the password or the username is wrong. The error message literally tells you what it tried—read it carefully.

What's actually happening here is that MySQL or MariaDB checks the exact password hash stored in mysql.user. One typo and you're locked out. The fix is simple: reset the password if you don't know it.

sudo mysql -u root -p
ALTER USER 'youruser'@'localhost' IDENTIFIED BY 'new_password';
FLUSH PRIVILEGES;

Pro tip: if you're on a fresh install and used the default password from a package manager (like apt install mariadb-server on Ubuntu 22.04), the root password is often blank. Try just hitting Enter when prompted.

2. Wrong host in the connection string

Adminer defaults to connecting to localhost. But your user might only be allowed from 127.0.0.1, or vice versa. This is a MySQL permission scoping issue. The error will show something like Access denied for user 'app'@'127.0.0.1' when the user is actually 'app'@'localhost'.

Check your user's host:

SELECT user, host FROM mysql.user WHERE user = 'youruser';

If you see 'youruser'@'localhost', but you're connecting via 127.0.0.1 in Adminer, that's the mismatch. The reason step 3 works is that MySQL treats localhost (Unix socket) and 127.0.0.1 (TCP) as different connections. Fix it by either changing Adminer's host field to match, or creating the user with both hosts:

CREATE USER 'youruser'@'127.0.0.1' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON yourdb.* TO 'youruser'@'127.0.0.1';
FLUSH PRIVILEGES;

Real-world trigger: Docker containers. If your MySQL runs in a container and Adminer runs on the host, connecting to localhost inside Adminer hits the host's MySQL socket, not the container. Use 127.0.0.1 in Adminer and ensure the user exists with 'user'@'127.0.0.1'.

3. Authentication plugin mismatch (caching_sha2_password)

This one bit me hard on MySQL 8.0+ and some MariaDB 10.6+ builds. The default auth plugin changed from mysql_native_password to caching_sha2_password. Old PHP versions that Adminer runs on (like PHP 7.4 or 8.0 without the right extensions) don't support this plugin. The error looks identical to a wrong password.

Check the user's plugin:

SELECT user, host, plugin FROM mysql.user WHERE user = 'youruser';

If you see caching_sha2_password, and Adminer uses an older PHP MySQL client, that's your problem. The fix is to alter the user back to mysql_native_password:

ALTER USER 'youruser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
FLUSH PRIVILEGES;

I prefer this over upgrading PHP because it's one command and doesn't touch your stack. But if you're security-conscious, update PHP to 8.1+ and ensure the mysqli extension uses the native driver that supports caching_sha2_password. You can verify by checking phpinfo()—look for "mysqlnd" in the mysqli section.

Quick-reference summary

CauseError clueFix in one line
Wrong passwordAccess denied for 'user'@'host'ALTER USER ... IDENTIFIED BY 'newpass'; FLUSH;
Wrong hostHost mismatch in error vs user tableCREATE USER 'user'@'127.0.0.1' ... or match Adminer host
Auth plugin mismatchPlugin = caching_sha2_passwordALTER USER ... IDENTIFIED WITH mysql_native_password BY 'pass';

Was this solution helpful?