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.

- 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.

- 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.

- 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.

- 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 the two lines auhtentication type and password Look for these two lines:
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['password'] = '';](https://www.meersworld.net/wp-content/uploads/2023/04/How-To-Set-Root-Password-In-phpMyAdmin-10.webp)
- 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.
![Update 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.](https://www.meersworld.net/wp-content/uploads/2023/04/How-To-Set-Root-Password-In-phpMyAdmin-11.webp)
- 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.

- 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.

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
- How To Install & Configure XAMPP On Windows 10 – Step By Step | For Beginners
- How To Change The XAMPP Server Port In Windows 10 | XAMPP Apache Server Port
- How To Install MAMP On Windows 10 Step By Step | How To Change The MAMP Server Ports
- How To Install WordPress On MAMP Server In Windows 10 – Step By Step
- How to Set Up PHP on IIS in Windows | Install PHP with IIS
- How to Download & Install WampServer on Windows

Meer Basit is the founder of Meer’s World. He’s been running the show since launching the blog back in 2018. By background he is a computer scientist. Primarily, he creates content around blogging (WordPress, Blogger, Tumblr), SEO, affiliate programs, earn-online, reviews, eCommerce, & technology. He has got years of professional experience in web programming, computer programming, databases, data warehousing, & transcription. In general, he likes traveling, gardening, creating TikToks(@iammeerbasit), watching movies, is a passionate cricketer, creative writer, and a GSD lover.

Unknown
April 24, 2020 at 4:06 pm
Thank you very much! Very helpful
Meer Basit
April 25, 2020 at 3:06 am
You’re most welcome.
Creater Hasan
June 21, 2020 at 1:46 pm
oldu çok teşekkür ederim. bu sorunu çözüp php derslerime devam edeceğim için çok mutluyum
Meer Basit
June 22, 2020 at 3:07 am
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)
Son Of KAIVAH
August 3, 2020 at 2:19 pm
Excellent and perfect. It worked for me.
Meer Basit
August 4, 2020 at 3:08 am
Thanks SoK!
Anonymous
September 3, 2020 at 3:50 pm
This worked perfectly, Thank you!
Meer Basit
September 4, 2020 at 3:11 am
You’re most welcome!
Cliff
October 21, 2020 at 6:04 am
Thank you!!! This was helpful.
Meer Basit
October 22, 2020 at 3:09 am
Thanks Cliff!
pandimuthu
November 23, 2020 at 7:44 am
Thanks very help full
Meer Basit
November 24, 2020 at 3:12 am
You’re most welcome, Pandimuthu!
Anonymous
December 17, 2020 at 4:41 am
excellent and perfect!!
Meer Basit
December 18, 2020 at 3:14 am
You’re most welcome.
Unknown
January 6, 2021 at 7:53 am
wow, it worked. Thanks
Meer Basit
January 7, 2021 at 3:15 am
You’re most welcome!
Meer Basit
January 16, 2021 at 3:16 am
You’re most welcome!
poyraz
February 20, 2021 at 3:11 pm
Thank you so much
Meer Basit
February 21, 2021 at 3:17 am
You’re most welcome Poyraz!
Buddharraj
April 28, 2021 at 8:05 am
well explained.. thank you so much
Meer Basit
April 29, 2021 at 3:19 am
You’re most welcome, Buddharraj!
Unknown
May 15, 2021 at 3:30 pm
Well Explained and a Perfect solution. Thank you so much!
Meer Basit
May 16, 2021 at 3:19 am
You’re welcome.
Sayan Chatterjee
May 18, 2021 at 2:28 pm
works like a charm
Meer Basit
May 19, 2021 at 3:20 am
You’re most welcome Sayan!