Skip to content
Fragmented Development

MariaDB / mysql root password on Debian Stretch

I was a little perplexed when I installed a MariaDB server on my main desktop running Debian Stretch; it didn't ask me for a root password. This is a change from the previous Debians, which always prompt you to set the password during installation.

Not to fret, though. It seems like the way to login as root is to run the client as root with the sudo command.

Instead of the old mysql -u root -p command, you can just use sudo mysql and you're presented with the root prompt!

Much easier to do, as long as you know what to do. :P

Tags: server


Thanks for this! I was stuffing around for ages trying to figure out why the hell I'd set the root password to something odd and how to reset it.

David Findlay –

Ah, thank! Yes it's neat however I would have never thought about it so many thanks for saving me.


Wow! Changing our dev environment from 8 to 9, couldn't be more thankful you found this out yesterday! Gracias!

Jake –

Thanks for your help, it does make it easier. :-)

Michael (travler7282)

Thanks very much, seems weird that you can't log in as root with a password, even if you set one!


Add Your Comment