Fixing SQLSTATE[HY000] [1044] Access Denied for 'pma'@'localhost' to Database 'phpmyadmin' in phpMyAdmin

🔧 Fixing SQLSTATE[HY000] [1044] Access Denied for 'pma'@'localhost' to Database 'phpmyadmin'

Recently, while setting up a new server for local testing, I encountered an error that many developers face:

#1044 - Access denied for user 'pma'@'localhost' to database 'phpmyadmin'

🧩 What’s the Root Cause?

This error typically occurs because:

  • The 'pma' user doesn’t have the necessary privileges.
  • Or the phpmyadmin database itself doesn't exist.
  • Sometimes, incorrect MySQL/MariaDB configuration during install leaves the setup incomplete.

💡 How I Fixed It

  1. Logged in using root:
    mysql -u root -p
  2. Checked for existence of phpmyadmin DB:
    SHOW DATABASES LIKE 'phpmyadmin';
  3. If not present, created manually:
    CREATE DATABASE phpmyadmin;
  4. Then granted all privileges to pma:
    
    GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY 'your_password';
    FLUSH PRIVILEGES;
    

🔄 Restart Services

After making these changes, I restarted MySQL/MariaDB and reloaded phpMyAdmin:

sudo service mariadb restart

✅ Result

The error was gone and phpMyAdmin started working as expected for the user 'pma'.

📌 Pro Tip

If you installed MySQL/MariaDB via XAMPP, make sure the config file config.inc.php points to a valid user with proper database access. You can also create a new user instead of fixing 'pma'.

🧠 Citation (APA Style)

Shaikh, S. S. (2025, June). Fixing SQLSTATE[HY000] [1044] Access Denied for 'pma'@'localhost'. Shoyshai Blog. https://shoyshai.blogspot.com/

Post a Comment

0 Comments