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

Posted October 14, 2014 18.3k 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.

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.

Submit an Answer
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