phpMyAdmin is throwing a #2002 cannot log in to the mysql server phpmyadmin

Viewed 191826

I have installed MySQL server enterprise 5.1 on my local machine and now I want to install phpMyAdmin, but it does not work.

I have unrared phpMyAdmin to my server root directory and browsed to "localhost/phpMyAdmin/setup/index.php", started a new server and the only setting I changed was filling in my MySQL password in the field "Password for config auth"

So now when I am trying to log in I get an error message saying "#2002 cannot log in to the mysql server phpmyadmin"

Does anyone know what's wrong? I've been having this problem since yesterday.

27 Answers

This can also be caused if you forget (as I did) to move config.inc.php into its proper place after completing the setup script.

After making the config folder and doing chmod o+rw config and going to localhost/phpmyadmin/setup and following those steps, you need to go back to the command line and finish things off:

mv config/config.inc.php .         # move file to current directory
chmod o-rw config.inc.php          # remove world read and write permissions
rm -rf config                      # remove not needed directory

See full instructions at https://phpmyadmin.readthedocs.org/en/latest/setup.html

For Ubuntu 14.04 and 16.04, you can apply following commands

First, check MySQL service is running or not using

sudo service mysql status

Now you can see you show a message like this: mysql stop/waiting.

Now apply command: sudo service mysql restart!

Now you can see you show a message like this: mysql start/running, process 8313.

Now go to the browser and logged in as root(username) and root(password) and you will be logged in successfully

my problem is solved by this step

  1. apt-get install mysql-server phpmy admin
  2. /etc/init.d/mysql restart
  3. done.
Related