How to get phpmyadmin username and password
Asked Answered
D

6

23

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;

Dowager answered 14/10, 2014 at 7:12 Comment(4)
It means you have forgotten your root password, then read this post : #10070901Decastyle
I also lost the username. Is there any way to get the username also?Dowager
"root" should be your usernameDecastyle
Your username and password are located in /etc/phpmyadmin/config-db.phpTheresa
T
24
 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'] = '';
Targum answered 14/10, 2014 at 8:1 Comment(0)
S
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

Shankle answered 14/10, 2014 at 7:38 Comment(4)
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 workingDowager
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.Shankle
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?Dowager
Yes this is a different problem. You should resolve this first.Check #13952200Shankle
M
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.

Malorie answered 23/12, 2017 at 16:34 Comment(2)
I found it by these 2 commands on ubuntu 20.04 LTS: cd /etc/phpmyadmin sudo vi config-db.phpHomeomorphism
I simply looked in this file and used the $dbuser='phpmyadmin' as the username and $dbpass='mypwdwaslistedhere' as the password;Muscular
B
2

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.

Brumal answered 30/1, 2018 at 19:34 Comment(2)
This assumes your root user doesn't have a password, and doesn't answer the question.Cuckoo
I works for me In first runSpinks
T
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.

Teryl answered 14/10, 2014 at 7:17 Comment(1)
I also lost the username. Is there any way to get the username also?Dowager
S
1

If you set the password while installing phpmyadmin.

The username will be phpmyadmin.

You can confirm the username & password in the

/etc/phpmyadmin/config-db.php Check file

This is the file which is called/included in /etc/phpmyadmin/config.inc.php

Surgeonfish answered 2/3, 2024 at 7:45 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Willed

© 2022 - 2025 — McMap. All rights reserved.