Forgot your database password? It happens to the best of us. If you’ve forgotten or lost 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 user account with
This tutorial demonstrates how to reset the root password for MySQL and MariaDB databases installed with the
apt package manager on Ubuntu 20.04. The procedure for changing the root password differs depending on whether you have MySQL or MariaDB installed and the default systemd configuration that ships with the distribution or packages from other vendors. While the instructions in this tutorial may work with other system or database server versions, they have been tested with Ubuntu 20.04 and distribution-supplied packages.
Note: On fresh Ubuntu 20.04 installations, the default MySQL or MariaDB configuration usually allows you to access the database (with full administrative privileges) without providing a password as long as you make the connection from the system’s root account. In this scenario, it may not be necessary to reset the password. Before you proceed with resetting your database root password, try to access the database with the
sudo mysqlcommand. Only if the default configuration for authentication was altered, and this results in an access denied error, follow the steps in this tutorial.
#mysql #mariadb #ubuntu 20.04
How To Reset Your MySQL or MariaDB Root Password on Ubuntu 20.04. If you’ve forgotten or lost 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 user account with sudo privileges.