When installing mysql, I didn't get asked to create a password.

Posted December 29, 2019 2.5k views

I typed sudo apt-get install mysql-server, pressed “y” and it installed. Now when it asks me for the password when typing the mysqlsecureinstallation command what should I do?

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

Hi @UbuntuNoob123,

Most probably it was displayed somewhere when you installed MySQL. What I’ll recommend you if it’s still a fresh installation is to remove the current MySQL and follow this DigitalOcean tutorial -

It’s for an Ubuntu OS however looking at your Nickname I would assume that’s what you are using.

The tutorial shows you everything necessary to install and configure it.


by Brian Boucheron
In this tutorial we will install the MySQL official apt software repository, then install the MySQL software itself, secure the installation, and finally we'll test that MySQL is running and responding to commands.

Hello @UbuntuNoob123

as @KDSys said your probably best removing and starting again,

However, for people wanting to reset the root password, you can follow the tutorial:

How To Reset Your MySQL or MariaDB Root Password

Simon Bennet
SnapShooter DigitalOcean Backups

by Mateusz Papiernik
Forgetting passwords happens to the best of us. If you forget or lose the root password to your MySQL or MariaDB database, you can still gain access and reset the password if you have access to the server and a sudo-enabled user account. This tutorial will cover how to...