Can not login to phpmyadmin with root user

29,170

Solution 1

I sloved it with below steps:

1) Open config.inc.php file

2) Change file permition to write

sudo chmod 777 /etc/phpmyadmin/config.inc.php

3) Add below line to the file

 $cfg['Servers'][$i]['user'] = 'root';
 $cfg['Servers'][$i]['password'] = 'MY_SQL ROOT_USER_PASSWORD';
 $cfg['Servers'][$i]['AllowNoPassword'] = true;

4) Change file parmissions to original again

 sudo chmod 755 /etc/phpmyadmin/config.inc.php

5) Restart server

service mysql start or service mysql start

6) open

http://localhost/phpmyadmin
username: root
password: YOUR_MYSQL'S ROOT USER'S PASSWORD
  • Successfully logged in to phpmyadmin.

Solution 2

This is the correct answer:

sudo dpkg-reconfigure -plow phpmyadmin

Solution 3

in terminal, type

sudo gedit '/etc/phpmyadmin/config-db.php'

The user file will get open Just check the username like

$dbuser='phpmyadmin';

And password like

$dbpass='1234';

Just copy this username and password without quotes in login page.

Share:
29,170
Pooja Mokariya
Author by

Pooja Mokariya

A Computer Engineer Graduated from Nirma University. Currently working as a Software Developer on Ruby On Rails Technology. Having a strong passion and strength to work as a Software Developer with Ruby on Rails Technology. Result oriented, self-learner, eager to learn new technologies, methodologies, strategies and processes

Updated on July 09, 2022

Comments

  • Pooja Mokariya
    Pooja Mokariya almost 2 years

    I am having trouble to login to with phpmyadmin in Ubuntu system.

    Username - root Password - empty

    but still it show me error like below

     #1045 - Access denied for user 'root'@'localhost' (using password: NO)
    

    Help me to solve it Thank you.

    • Shubham Dixit
      Shubham Dixit almost 6 years
      You have to reinstall mysql ,thats the only way i found when I had similar trouble for ubuntu 14.04 and try disallowing remote login this time
    • Anant - Alive to die
      Anant - Alive to die almost 6 years
      that means the password is not correct. you have to provide the correct password.You can reset the password using command line:-Resetting forgotten phpmyadmin password
    • Pooja Mokariya
      Pooja Mokariya almost 6 years
      ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
  • Nico Haase
    Nico Haase almost 6 years
    How do you login as root using the credentials for phpMyAdmin's user?
  • Cameron Tacklind
    Cameron Tacklind about 4 years
    This answer is wrong. Those are the credentials created by dbconfig for extra phpMyAdmin features. That will be a limited user that you should not use.
  • Cameron Tacklind
    Cameron Tacklind about 4 years
    This is an incredibly insecure solution. You're setting you phpMyAdmin to be completely open to whoever can connect to it. You probably don't even want to do this on a private network because of possible XSS attacks.
  • Manuel Guzman
    Manuel Guzman almost 4 years
    I was not trying to use a blank root password as that is completely insecure, but still could not login. The above did not work for me. However this did work (manurevah.com/blah/en/p/Re-Allowing-root-access-to-PhpMyAdm‌​in) From shell login as root: mysql -u root -p mysql Remove the plugin value from root: update user set plugin='' where user='root'; Flush: flush privileges; To set it back use to disallow root via phpmyadmin: update user set plugin='unix_socket' where user='root';