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

Hi, 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/mysql_secure_installation 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. Thanks

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.

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