phpMyAdmin is a popular web-based application used to manage MySQL databases. However, forgetting the password for your phpMyAdmin account can be a frustrating experience. This blog post will provide a step-by-step guide on resetting your forgotten phpMyAdmin password in Ubuntu. By following these instructions, you can regain access to your MySQL databases.
Step 1: Access the phpMyAdmin Configuration File
The first step is to locate and access the phpMyAdmin configuration file. In Ubuntu, the configuration file is located at /etc/phpmyadmin/config.inc.php. Open a terminal window and navigate to the location of the configuration file using the following command:
cd /etc/phpmyadmin/
Step 2: Edit the Configuration File
Open the phpMyAdmin configuration file in a text editor using the following command:
sudo nano config.inc.php
Look for the following code:
$cfg[‘Servers’][$i][‘password’] = ‘your_password’;
Change “your_password” to a new password of your choice. Save the changes to the configuration file by pressing “Ctrl+X”, then “Y”, and finally “Enter”.
Step 3: Generate a Hashed Password
phpMyAdmin stores passwords as hashed values in the MySQL database. You will need to generate a new hashed password using the following command in the terminal:
echo -n 'your_new_password' | openssl sha1
Replace “your_new_password” with the new password you chose in Step 2. The command will generate a hashed value for your new password. Copy the hashed value.
Step 4: Update the MySQL Database
Log in to your MySQL database using the following command in the terminal:
mysql -u root -p
You will be prompted to enter the MySQL root user password. Enter the password and press “Enter”.
Locate the “users” table and find the row with your phpMyAdmin user account. Update the “password” field with the hashed password you generated in Step 3 using the following command:
UPDATE mysql.user SET Password=PASSWORD('your_new_password') WHERE User='your_username';
Replace “your_new_password” with the hashed value you copied in Step 3, and “your_username” with your phpMyAdmin username.
Step 5: Flush the Privileges
After updating the password in the MySQL database, you will need to flush the privileges using the following command:
FLUSH PRIVILEGES;
Step 6: Verify the Changes
Log in to phpMyAdmin using your new password. If you can access your MySQL databases, then the password reset was successful.
Conclusion:
Resetting a forgotten phpMyAdmin password in Ubuntu is a straightforward process that can be completed in just a few steps. By following the step-by-step guide outlined in this blog post, you can regain access to your MySQL databases. Remember to choose a strong password and store it securely to avoid any future password-related issues.
For the reference link, please visit here:
https://askubuntu.com/questions/321903/resetting-forgotten-phpmyadmin-password