Default mysql password

July 4, 2013 50k views
Just set up my first droplet - LAMP on Ubuntu 12.04 What would be the password for mysql -
11 Answers
If you installed LAMP ubuntu or whatever flavour of Linux that just cat the motd message to find the password (why put it here i wonder?????)
root@domain:/var/www# cat /etc/motd.tail
Thank you for using DigitalOcean's LAMP Application.
Your web root is located at /var/www/html and can be seen from
The details of your PHP installation can be seen at
Your MySQL root user's password is XXXXXXXXXX
You are encouraged to run mysql_secure_installation to ready your server for production.
To delete this message of the day: rm -rf /etc/motd.tail

When you install a LAMP droplet in digitalOcean
this is the code to get your mysql password
cat /root/.digitalocean_password

Log in and like this answer so that it can get to the top

You create it yourself. The initial MySQL password is the root password, so make sure you create a strong one. If you need some help on that front, try

If you're asking how to set the password for MySQL, you can activate MySQL (if you haven't done so already) after installing it, by executing this command:
sudo mysql_install_db

Then, run the MySQL set up script:
sudo /usr/bin/mysql_secure_installation

A prompt will ask you for your current root password. Press enter if you did not create one when you first installed MySQL.
Enter current password for root (enter for none)
I installed an image with mysql already installed and assumed the mysql password would be the same as my root password.
It was not but upon logging in with ssh the message stated that the mysql root user password is 'password' and I was able to login and change that
sudo mysql_install_db

after running the above command its asking for the password.
this is my first installation of mysql
what password should i give here
please help me as soon as possible
@harish.pemmasani: What OS are you using? Did you install MySQL yourself? If so, you'll need to enter the root password you chose while installing MySQL.

If you're using the LAMP stack image with MySQL pre-installed, the root password is set to 'password' by default.
'password' doesn't work for me when using the one-click LAMP install on Ubuntu 14.04.

What should I do?
On Ubuntu 14.04 with one-click LAMP the default password was not 'password' it was only available via SSH immediately after login the message shows the correct password within the introductory text.
The image was updated recently, the password is now randomly generated for each droplet.
  • So then how would I find out what the password is? Need to update a corrupt wp-config file.

I found this link much more useful, having not started from the wordpress image... It shows you how to reset the password from the MySQL CLI.

Have another answer? Share your knowledge.