Question

Access denied for installing MYSQL?

I tried to follow this tutorial: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu To install the MYSQL database, but when I get to the command “sudo /usr/bin/mysql_secure_installation” and I try to enter my root password of the server, it keeps on tell me I have the wrong password. The error message is as below:

ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

I am sure the password I entered is correct. Any one can provide some help here?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

If you still have this problem, try resetting your password using the following steps.

Stop the MySQL Server. On your terminal run these commands:

sudo /etc/init.d/mysql stop

Then start the mysqld configuration. enter this command

sudo mysqld --skip-grant-tables &

Login to MySQL as root.

mysql -u root mysql

Replace YOURNEWPASSWORD with your new password!

UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; 
FLUSH PRIVILEGES; exit;

See if it works. *NOT A VERY SECURE METHOD OF CHANGING/RESETTING PASSWORDS BUT IT SHOULD WORKS

This comment has been deleted

i followed the steps mentioned above but it does not work, i keep getting this error **ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ **