Where is the MariaDB password stored on Linux?

Where is the MariaDB root password stored on Linux? The version is 10.3.18. I’ve looked in /etc/mysql/my.cnf but it’s not in there. I don’t want to change the password I just want to see what it is.

Add Comment
2 Answer(s)

It’s not stored in a form you can read back, it will be hashed and scrambled beyond recovery. You cannot see what it is.

The exception to this is when MySQL boots up for the first time on a clean install it generates a new root password and logs this in the standard MySQL log. Look in /var/log/mysql.

Add Comment

The documentation describes a way to get into MySQL/MariaDB if you forget the root password. For security, it only works from the same machine, and only if you have OS’s root permission.

Non-root passwords, like the root password, are stored via one-way encryption.

Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.