ERROR 1045 (28000): Access denied for user 'root'@'localhost'

October 14, 2014 9.9k views

I had created a droplet with Ubuntu 14.04 and LEMP as application. After completing I had tried this command to secure mysql sudo /usr/bin/mysqlsecureinstallation and when ask for password I had made enter as I do not know root password. Its saying ERROR 1045 (28000): Access denied for user 'root'@'localhost'. I had tried to install phpmyadmin same problem there. I am now unable to use my droplet. How to use mysql after creating a drplet with LEMP application? Please help.

2 Answers

A random password is generated for the MySql root user. When you logon to the console of a LEMP one-click droplet, you should see something like:

Thank you for using DigitalOcean's LEMP Application.
Your web root is located at /usr/share/nginx/html and can be seen from http://XXX.XXX.XX.XX/
The details of your PHP installation can be seen at http://XXX.XXX.XX.XX/info.php
Your MySQL root user's password is txetdmRqpZ
You are encouraged to run mysql_secure_installation to ready your server for production.

If you need to see the password again, run: cat /etc/motd.tail

root@ubuntu-16:~# cat /etc/motd.tail
cat: /etc/motd.tail: No such file or directory

Have another answer? Share your knowledge.