22

I have intalled phpmyadmin recently in my system. Now I lost its username and password. I tried the below methods for login.

in etc/phpmyadmin/config.inc.php I activated the AllowNoPassword

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

SonalPM
  • 1,317
  • 8
  • 17
John Mathew
  • 395
  • 1
  • 3
  • 16

5 Answers5

23
 Step 1:

    Locate phpMyAdmin installation path.

    Step 2:

    Open phpMyAdmin>config.inc.php in your favourite text editor.

    Step 3:

    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = '';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['AllowNoPassword'] = true;
    $cfg['Lang'] = '';
Hara Prasad
  • 704
  • 6
  • 15
5

Try changing the following lines with new values

$cfg['Servers'][$i]['user'] = 'NEW_USERNAME';
$cfg['Servers'][$i]['password'] = 'NEW_PASSWORD';

Updated due to the absence of the above lines in the config file

Stop the MySQL server

sudo service mysql stop

Start mysqld

sudo mysqld --skip-grant-tables &

Login to MySQL as root

mysql -u root mysql

Change MYSECRET with your new root password

UPDATE user SET Password=PASSWORD('MYSECRET') WHERE User='root'; FLUSH PRIVILEGES; exit;

Kill mysqld

sudo pkill mysqld

Start mysql

sudo service mysql start

Login to phpmyadmin as root with your new password

geoandri
  • 2,360
  • 2
  • 15
  • 28
  • There is no option in my config file for user and password. But there is option for control user $cfg['Servers'][$i]['controluser'] = 'root'; $cfg['Servers'][$i]['controlpass'] = 'root'; I changed the control user but it's not working – John Mathew Oct 14 '14 at 08:03
  • I think the absence of those lines show that you username is root and you 'll have to change the root password in mysql server. I will edit my answer. – geoandri Oct 14 '14 at 08:19
  • when I run the command sudo service mysql stop it shows the error sudo: /etc/sudoers.d is world writable stop: Unknown instance: is it because of the permission? – John Mathew Oct 14 '14 at 09:06
  • Yes this is a different problem. You should resolve this first.Check http://stackoverflow.com/questions/13951700/sudoers-is-world-writable-error – geoandri Oct 14 '14 at 09:24
5

Try opening config-db.php, it's inside /etc/phpmyadmin. In my case, the user was phpmyadmin, and my password was correct. Maybe your problem is that you're using the usual 'root' username, and your password could be correct.

Hanz Marín
  • 51
  • 1
  • 2
1

If you don't remember your password, then run this command in the Shell:

mysqladmin.exe -u root password NewPassword

where 'NewPassword' is your new password.

Vidhyut Pandya
  • 1,605
  • 1
  • 14
  • 27
-1

I had a problem with this. I didn't even create any passwords so I was confused. I googled it and I found out that I should just write root as username and than click GO. I hope it helps.