How to fix phpmyadmin error: “Connection for controluser as defined in your configuration failed”

January 3rd, 2011 by rvdavid Leave a reply »

“Connection for controluser as defined in your configuration failed” It’s one of those small, annoying messages that appear out of the way on your screen, but still catches your eye once in a while especially when you’re deep in thought about how to building a multi-join query in the SQL tab of phpmyadmin.

Well, it annoyed me today so much that I finally decided to do something about it and finally take a look. I opened up the PHPMyAdmin config file located at /etc/phpmyadmin/config-db.php  on Ubuntu Maverick Meerkat. There’s a default username and password in $dbuser and $dbpass variables.

Now my knee jerk reaction to this would have been “no problem I’ll just change that to my root username and password.” which will work by the way, but I decided against it since the control user for PHPMyAdmin did not really need to have access to all the other databases in my local cluster.

I decided instead to create a new user in MySQL, granted it with all privileges to `phpmyadmin`.* and gave it a strong password.

#mysql -umyrootuser -p
mysql> GRANT ALL PRIVILEGES on `phpmyadmin`.* to ‘somephpmyadminuser’@'localhost’ IDENTIFIED BY ‘somestrongpassword’;

Next, I updated the file in /etc/phpmyadmin/config-db.php to reflect the details of the new user I created. I opened it up with vim as a super user in ubuntu.

#vim /etc/phpmyadmin/config-db.php

Then I updated the file:

$dbuser=’somephpmyadminuser’;
$dbpass=’somestrongpassword’;
$basepath=”;
$dbname=’phpmyadmin’;
$dbserver=”;
$dbport=”;
$dbtype=’mysql’;

After saving that file, PHPMyAdmin will no longer report that the “Connection for controluser as defined in your configuration failed”. Because it doesn’t fail anymore, your controluser as defined in your configuration file now has access to the phpmyadmin database.

if you enjoyed this post, make sure you subscribe to my RSS feed!
You can also follow me on Twitter here.

Related posts:

  1. Importing SQL dumps into MySQL through Command line
  2. Enable SSH Access to Xubuntu
Advertisement

23 comments

  1. Rouhollah says:

    Thanks, it was useful for me

  2. tomslick says:

    That was truly an annoying message – thanks for the tip!

  3. Anonymous says:

    Greatly appreciated. Thanks!

  4. Grindlay says:

    Even simpler :
    Privileges > pma > edit privileges >

    change password to match what you have set in config.inc.php

    • Modus Tokus says:

      Thanks Grindlay your method sounded simple so I tried it first. Since I am high I kept typing the password in the wrong section (that would change the pma web password, but not the pma mysql account password). Eventually I noticed and the error was gone instantly.

    • zaq says:

      Thanks a lot. It worked. Its the simplest of all.

    • zaq says:

      Grindlay,

      FYI, I did the opposite, i recently changed my root and pma passwords but forgot to update the same in phpmyadmin’s config file. Thanks again, I was reminded by you and set the new password in the config file. the annoying msg is gone.

      For those who are trying to reset your mysql password on windows, stop your mysql service and open your notepad and copy, paste and adjust the path to mysql’s service exe and put your password and then save the file as a batch file. Run the batch file.

      Do remember to update your phpMyAdmin’s config.inc.php file.

      Credit for batch file goes to: XAMPP. but i’ve modified it for resetting new password. (the original batch file removes the password…)

      cioa.
      Zaq.

      start -> run:

      notepad reset_mysql_password.bat

      copy, paste, edit and save the following batch file contents:

      @REM —BATCH_FILE_BEGINS
      @echo off
      echo USE mysql; >resetroot.sql

      echo REPLACE INTO user VALUES (‘localhost’, ‘root’, PASSWORD(‘your_new_root_password’), ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ”, ”, ”, ”, 0, 0, 0, 0, ”, ”); >>resetroot.sql

      echo REPLACE INTO user VALUES (’127.0.0.1′, ‘root’, PASSWORD(‘your_new_root_password’), ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ”, ”, ”, ”, 0, 0, 0, 0, ”, ”); >>resetroot.sql

      echo REPLACE INTO user VALUES (‘localhost’, ‘pma’, PASSWORD(‘your_new_control_user_password’), ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ‘N’, ”, ”, ”, ”, 0, 0, 0, 0, ”, ”); >>resetroot.sql

      path_to_your\mysqld.exe –no-defaults –bind-address=127.0.0.1 –bootstrap –console –standalone nul

      del resetroot.sql

      echo.
      echo Passwords for user “root” and “pma” is reset.
      echo.
      pause

      REM —BATCH_FILE_ENDS

    • bitkahuna says:

      Grindlay, thanks, and thanks to this site for leading me to fix this annoying error.

  5. OlivierCuyp says:

    It might be easier to follow phpmyAdmin instructions @ http://wiki.phpmyadmin.net/pma/control_user

  6. Gareth Morgan Thomas says:

    mysql -umyrootuser -p

    this first part asks me for a password – which i do not know so none of it works

  7. bitkahuna says:

    also wanted to mentioned annoying sql error i’d get looking at privileges for a specifc db – fixed by running the command line ‘mysql_upgrade’ on my server.

  8. mhmd says:

    I’ve faced the same problem and did your notes but doesn’t fix the prloblem

  9. Jak Wings says:

    Thanks. It just help!

  10. toto24 says:

    Hi : realy usefull, Thank’s !
    But why did you add a new user ?
    I just gave Privileges to the default account in /etc/phpmyadmin/default-db.php.
    Think about dependencies of this account :D

  11. Joe says:

    Many thanks for pointing me to /etc/phpmyadmin/config-db.php.

    I’ve been searching for a while…

  12. Louis Passano says:

    With the information you provided I took another option. Rather than edit the /etc/phpmyadmin/config-db.php file, I created a phpmyadmin user and database, granting all privileges. Seems to have worked.

    Also had to run script extracted from /usr/share/doc/phpmyadmin/examples/create_tables.sql.gz. That got rid of all the warnings and enables extended features. This is on ubuntu 12.04

  13. sweet. Thanks. It was very annoying and never thought to check that.

  14. asha says:

    Thanks, it was useful for me

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.