How to Set Root Password on phpMyAdmin

Updated:

by

how to set root password in phpmyadmin

Do you want to set root password on phpMyAdmin? You’re in the right place.

In this tutorial, I will guide you step-by-step on How to set root password on phpMyAdmin in order to secure your databases.

Some web servers like XAMPP do not set a root password for phpMyAdmin. To secure your phpMyAdmin from unauthorized access you need to set a root password.

How to Set Root Password on phpMyAdmin

Follow the steps to learn about setting root password on phpMyAdmin.

  • Open phpMyAdmin on your localhost.
  • This is the direct URL of the phpMyAdmin: http://localhost/phpmyadmin/.
  • On your phpMyAdmin Dashboard and click on the User accounts tab.
Open phpMyAdmin on your localhost.
  • Look for the row that contains User name: root & Host name: localhost. You can see that there is No for Password.
  • Click on the Edit privileges link, as shown below.
Look for the row that contains User name: root & Host name: localhost. You can see that there is No for Password. Click on the Edit privileges link, as shown below.
  • Click on the Change password button.
Click on the Change password button.
  • Choose the Password option.
  • Enter a Password.
  • On Password Hashing choose Native MySQL authentication.
  • Click on the Go button.
Choose the Password option. Enter a Password. On Password Hashing choose Native MySQL authentication. Click on the Go button.
  • You can see that the password for User name root has been set successfully.
You can see that the password for User name root has been set successfully.
  • Now open phpMyAdmin (http://localhost/phpmyadmin/) again.

You may see this error:

  • Cannot connect: invalid settings.
  • mysqli::real_connect(): (HY000/1045): access denied for user ‘root’@’localhost’ (using password: NO).
  • phpMyAdmin tried to connect to the MYSQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
Cannot connect: invalid settings. mysqli::real_connect(): (HY000/1045): access denied for user 'root'@'localhost' (using password: NO).
  • Now go to XAMPP installation folder.
  • Click on the phpMyAdmin folder.
  • Look for the file config.inc.php and open it on the Notepad or PHP Editor.
Now go to XAMPP installation folder. Click on the phpMyAdmin folder. Look for the file config.inc.php and open it on the Notepad or PHP Editor.

Look for these two lines:

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['password'] = '';
Look for these two lines:$cfg['Servers'][$i]['auth_type'] = 'config';$cfg['Servers'][$i]['password'] = '';
  • Replace ‘config‘ with ‘cookie‘.
  • Enter your password in the line: $cfg[‘Servers’][$i][‘password’] = ‘Enter_Password_Here’; that you have created for the root user on phpMyAdmin.
  • Save the config.inc.php file.
Replace 'config' with 'cookie'. Enter your password in the line: $cfg['Servers'][$i]['password'] = ''; that you have created for the root user on phpMyAdmin.
  • Now go back to the Error page and click on the Retry to connect button or open phpMyAdmin (http://localhost/phpmyadmin/) again.
Now go back to the Error page and click on the Retry to connect button or open phpMyAdmin (http://localhost/phpmyadmin/) again.
  • You can see that the error has been removed and phpMyAdmin is asking for the root username and password.
You can see that the error has been removed and phpMyAdmin is asking for the root username and password.
  • After login you can access to your phpMyAdmin Dashboard.
After login you can access to your phpMyAdmin Dashboard.
  • Go to User accounts on your phpMyAdmin dashboard. You can see that Password is Yes for the root User Name.
Go to User accounts on your phpMyAdmin dashboard. You can see that Password is Yes for the root User Name.

If you like this post don’t forget to share this post with other people. Share your feedback in the comments section below.

Also Read

Related Topics: , , ,
How to Start a WordPress Blog and Make Money
Amazon Seller Services, Account Management, Amazon PPC, Catalog Management, Amazon SEO, Product Research, Product Sourcing.
Buy Namecheap Domain and Webhoting
Download Website Themes
Mangools SEO Tools

25 responses

  1. Unknown Avatar

    Thank you very much! Very helpful

    1. Meer Basit Avatar

      You’re most welcome.

  2. Creater Hasan Avatar

    oldu çok teşekkür ederim. bu sorunu çözüp php derslerime devam edeceğim için çok mutluyum

    1. Meer Basit Avatar

      You are welcome Hasan. Probably you said in Turkish (Thank you very much. I am very happy to solve this problem and continue my php lessons)

  3. Son Of KAIVAH Avatar

    Excellent and perfect. It worked for me.

  4. Anonymous Avatar
    Anonymous

    This worked perfectly, Thank you!

    1. Meer Basit Avatar

      You’re most welcome!

  5. Cliff Avatar

    Thank you!!! This was helpful.

  6. pandimuthu Avatar

    Thanks very help full

    1. Meer Basit Avatar

      You’re most welcome, Pandimuthu!

  7. Anonymous Avatar
    Anonymous

    excellent and perfect!!

    1. Meer Basit Avatar

      You’re most welcome.

  8. Unknown Avatar

    wow, it worked. Thanks

    1. Meer Basit Avatar

      You’re most welcome!

  9. Meer Basit Avatar

    You’re most welcome!

  10. poyraz Avatar

    Thank you so much

    1. Meer Basit Avatar

      You’re most welcome Poyraz!

  11. Buddharraj Avatar

    well explained.. thank you so much

    1. Meer Basit Avatar

      You’re most welcome, Buddharraj!

  12. Unknown Avatar

    Well Explained and a Perfect solution. Thank you so much!

    1. Meer Basit Avatar

      You’re welcome.

  13. Sayan Chatterjee Avatar
    1. Meer Basit Avatar

      You’re most welcome Sayan!

Leave a Reply

Your email address will not be published. Required fields are marked *