I was working on phpmyadmin normally, but today for some reason every time i try to login with any user "even the root user", i receive the below error

#1045 Cannot log in to the MySQL server

I checked mysql is running normally on server, and i can login using command line with all users normally.

There is no error log in apache or mysql!

Any suggestion please?


Summary of multiple possible solutions

Apparently one of the methods (comments) helped to solve the problem, so I summarize them here:

  1. Modify configuration file:

    Edit config.inc.php:

    Change localhostto

    You can find the configuration file in /etc/phpmyadmin/.

    No restarting of phpMyAdmin is required since edits in this configuration file are applied automatically.

  2. Creating a new password:

    $ mysqladmin -u root password NEWPASSWORD
  3. Reinstalling phpMyAdmin (Uninstallation + new Installation):

    sudo apt-get remove phpmyadmin
    sudo apt-get update
    sudo apt-get install phpmyadmin

    More Details for the new installation can be found here.

  • modified in both lines: if (empty($dbserver)) $dbserver = ''; and if (!empty($dbport) || $dbserver != ''), still same error! – MohammedSimba Sep 30 '15 at 12:39
  • $ mysqladmin -u root password NEWPASSWORD could also help – h0ch5tr4355 Sep 30 '15 at 12:45
  • I tried to change the root password, flushed the privileges, and restarted mysql, same issue! – MohammedSimba Sep 30 '15 at 12:53
  • The weird thing is, i didn't change anything related to mysql lately, suddenly all users fails to login using phpmyadmin, but works perfectly on command line – MohammedSimba Sep 30 '15 at 12:54
  • So it probably has only to do with phpma, did you try a simple reinstallation of phpmyadmin or did you make many configuration changes? – h0ch5tr4355 Sep 30 '15 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.