Learn how to easily prevent this exception from appearing in PHPMyAdmin with XAMPP.

How to remove PHPMyAdmin error: mysqli::real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: YES)

In a previous article, I explained how to change MariaDB with MySQL 8 in a local installation of XAMPP for Windows. This procedure works and it's just perfect for your local environment, however, in some installations a couple of errors that don't interfere with the default behaviour of the tool may appear. One of those exceptions is the following one: mysqli::real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: YES).

In this short article, I will explain to you how to easily solve this problem properly.

Solving exception

The first thing you need to do is to access the MySQL CLI and log in as root (which is what you usually do in XAMPP locally, there's no password as well):

mysql -u root -p

In case that your setup is different and it does contain a password, you will need to provide it (or leave empty if you don't). After accessing the command line, you need to run the following query that will create the PMA user without a password (it is usually empty for local development):

-- Create the PMA user without a password ---
CREATE USER 'pma'@'localhost' IDENTIFIED BY '';

After creating the user, you need to provide the control user credentials in the xampp/phpMyAdmin/config.inc.php file. These lines exist already, so be sure to search them in the file and update the user and password. In this case, as specified in our query, the user is pma and there's no password:

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';

Finally, restart the MySQL service and access PHPMyAdmin once again. You shouldn't see the exception ever again!

Happy coding ❤️!

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.