Hi,

i'm having some trouble with my MySQL server where i can't log in or connect to it from the terminal , phpmyadmin or my server control panel. the password is correct , i have reset it a number of times but still get the same message:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)

does anybody know what might cause this (please don't say the password is wrong)

Thanks,
Matt

Dani AI

Generated

Quick summary and practical checks (short): the three most common causes here are (a) the client is connecting over a different transport than the server expects (local socket vs TCP), (b) the root account is configured to use a socket-based authentication plugin instead of a password, or (c) the account row in the server’s grant table doesn’t match the client host you’re coming from. ’s socket-path suggestion is on point — local connections often use a Unix socket by default on Unix-like systems. (dev.mysql.com)

Immediate, low-risk troubleshooting steps to try now:

# force a TCP connection from the CLI (bypasses the Unix socket)
mysql -u root -p -h 127.0.0.1

# or explicitly force TCP
mysql --protocol=TCP -u root -p

# if you can connect, inspect accounts and plugins
sudo mysql -e "SELECT User, Host, plugin FROM mysql.user;"

If forcing TCP works, the problem is almost certainly a socket-path / client-config mismatch (CLI vs PHP/ControlPanel), or a host-entry difference in mysql.user. (dev.mysql.com)

If the plugin column for root@localhost is auth_socket (or similar), that means the server authenticates root by the OS socket/peer-credential rather than a password. On Debian/Ubuntu this is commonly used; in that case sudo mysql will let you in and you can switch the root account to password authentication:

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourNewStrongPass!';
FLUSH PRIVILEGES;
EXIT;

After this you’ll log in with mysql -u root -p. See the MySQL docs on socket authentication and how to change the plugin. (dev.mysql.com)

If you truly cannot connect at all (no interactive access), reset the root credentials safely using the official methods (init-file or restart with grant tables disabled), then restart normally and remove any temporary files you created. Follow the step-by-step procedures in the MySQL manual and be careful: these methods temporarily disable authentication and should be done from a trusted console. (dev.mysql.com)

Checklist recap: try -h 127.0.0.1 first; check plugin and Host in mysql.user; confirm the socket path the server is using vs what phpMyAdmin/your control panel is configured to use; if auth_socket is active, either use sudo mysql to get in or ALTER the account to a password-based plugin.

Depending on the platform "localhost" might connect via a Unix domain socket. If this is the case, then it might be that there is a mismatch between where the socket is really located in the filesystem (as specified in my.ini) and where the MySQL client (whatever you are using as a client) expects it.

To test that, I would try the connection using the mysql command line client and use the identical my.ini file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.