phpMyAdmin is a popular tool used to manage MySQL databases through a web interface. However, allowing root login through phpMyAdmin can pose a security risk because it gives complete control over the database. Disabling root login in phpMyAdmin is a simple yet effective way to protect your system from unauthorized access.
In this guide, we will walk you through easy steps to disable root login, making your phpMyAdmin setup more secure without affecting its functionality for other users.
Disable root Login in phpMyAdmin
First of all, find the phpMyAdmin directory location as per your installation. Generally, it is installed under /usr/share/phpmyadmin
directory. In some cases, the configuration file may be located under the /etc/phpmyadmin
directory.
Switch to the phpMyAdmin directory:
cd /usr/share/phpmyadmin
Then edit the config.in.php
in that directory. This is the main configuration file used by the phpMyAdmin.
vim config.inc.php
Now, add/update the following parameters:
$cfg['Servers'][$i]['auth_type'] = 'cookie ';
$cfg['Servers'][$i]['AllowRoot'] = FALSE ;
Some of the default installations may not have the config.inc.php. In that case, you can make a copy of the config.sample.inc.php file at the same location.
cp config.sample.inc.php config.inc.php
Test Configuration
Open phpMyAdmin in a web browser and try login with the root account. You will see “Access denied!” error message on screen. It means the changes work correctly.
Conclusion
Disabling root login in phpMyAdmin is a crucial step in securing your database. By following these steps, you can significantly reduce the risk of unauthorized access. Remember, security is an ongoing process, and it’s important to stay vigilant and keep your systems updated.
1 Comment
Thanks! But how without ‘root’ then do I access the phpmyadmin? 🙂