Resetting forgotten phpmyadmin password

I recently installed LAMP on Ubuntu 13.04(32-bit) but forgot my phpMyAdmin password. How can I reset its password without re-installing it?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Simply change or reset your MySQL root password by doing the following:

  1. Stop the MySQL server

    sudo service mysql stop
  2. Start mysqld

    sudo mysqld --skip-grant-tables &
  3. Login to MySQL as root

    mysql -u root mysql
  4. Change MYSECRET with your new root password

  5. Kill mysqld

    sudo pkill mysqld
  6. Start mysql

    sudo service mysql start
  7. Login to phpmyadmin as root with your new password

Solution 2

You don’t actually need to reset your username and password, if you can see them.

In your terminal window, type:

sudo -H gedit /etc/dbconfig-common/phpmyadmin.conf

This will open your phpmyadmin configurations.

There, you will see your username under dbc_dbuser='your_username' and password under dbc_dbpass='your_password'.

Solution 3

There is a workaround on Debian (Ubuntu, Mint, etc.) where there is a second admin account automatically generated by the system called


You can see (and should not change) its password via

sudo nano /etc/mysql/debian.cnf

It is possible (sure on Ubuntu 16.04) to use that account both in phpMyAdmin as well as in the command line

mysql -u debian-sys-maint -p

The account has exactly the same privileges as phpMyAdmin’s / MySQL’s root.

Solution 4

I was wondering why my login was failing even though I never changed the password.

It was failing because I rebootet the server and the mysql server was not startet automatically. So I startet the server and it worked again.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply