ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) Using Debian: I have uninstalled and reinstalled mysql using apt-get remove --purge mysql*, then reinstalled. Running mysql_secure_installation does not work because it will not accept my password. I hoped clearing all things mysql related would reset the password used for this. How can I have a clean start with mysql? How can I prevent this from happening in the future?
Thank you
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hello,
The error you’re encountering, “ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)”, is a common MySQL authentication issue. It seems like there’s a problem with the root password or the way MySQL is interpreting your login credentials. Here’s a step-by-step guide to resolve this and ensure a clean start with MySQL on Debian:
Uninstall MySQL Completely:
Reinstall MySQL:
Secure MySQL Installation:
mysql_secure_installation
script:Troubleshooting the Root Password:
new_password
with your new root password. Then restart MySQL:Besides that, check for any error logs in
/var/log/mysql/
for more specific error messages and ensure that there are no other conflicting services or incorrect configurations.Best,
Bobby
apt-get install mysql