9

Hi I know its an old question but I have tried many answers and guides but all in vain. I was using phpmyadmin without password on my local machine previously and I changed password using command prompt on windows with following command

mysqladmin.exe -u root password root

Since then I am not able to open my localhost/phpmyadmin and I get following error

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

I have tried changing config.inc.php current status of this file is as following

$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'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';

I have tried changing password from localhost/security.php and changed password to 123. I have also tried reseting root password by opening resetroot.bat batch file. I seriously think I have messed all up so if someone can help me here i shall be thank full. I am using Xampp on windows 7

EDIT Also I would like to tell you that I have tried giving new password to

$cfg['Servers'][$i]['password'] = '';

And also to

$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';

changing user to root

Community
  • 1
  • 1
Talha Malik
  • 1,509
  • 3
  • 22
  • 44

5 Answers5

14

Open xampp/phpMyAdmin/config.inc and change the line

$cfg['Servers'][$i]['auth_type'] = 'config';

to

$cfg['Servers'][$i]['auth_type'] = 'cookie';

PhpMyAdmin will then show a login screen where you can enter your username and password.

Holger
  • 475
  • 6
  • 14
  • 1
    Not quite sure why this is a thing though, change password = immediately lock down phpMyAdmin. Some sort of bug? Seems ridiculous. – Zuno Apr 02 '20 at 18:03
  • The "infrastructure" surrounding SQL and PHP is an archaic holdover from ancient times. – GirkovArpa Aug 31 '20 at 00:27
  • I did the above and it is showing the login screen. But when I gave username as root and respective password, it still not able to login. showing `mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)` Anyone knows how to deal this? – Anu Oct 19 '22 at 07:30
1

You are define your root password to 'root' with a command prompt, so in config you must have to use same :

$cfg['Servers'][$i]['password'] = 'root';
TarangP
  • 2,711
  • 5
  • 20
  • 41
Benjamin
  • 31
  • 4
0

There is a batch file called resetroot.bat located in the xammp folders 'C:\xampp\mysql' run this and it will delete the phpadmin passwords. Then all you need to do is start the MySQL service in xammp and click the admin button.

Source:How to get back Lost phpMyAdmin Password, XAMPP

Community
  • 1
  • 1
Antony
  • 512
  • 2
  • 18
0

You have to change the password in the config In case you forgot your password click on the reset password .bat file found in the mysql folder in the xampp root folder

$cfg['server'][$i]['password'] = 'PassWordHere'

Also revert the changes to the PMA config since that can cause things to brake

Lars Dormans
  • 171
  • 1
  • 13
0

just change the values in config.inc.php in phpmyadmin folder inside xampp folder open file and change

cfg['Servers'][$i]['auth_type'] = 'config';

to

cfg['Servers'][$i]['auth_type'] = 'cookie';

and

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

to

cfg['Servers'][$i]['AllowNoPassword'] = false;
DaszuOne
  • 759
  • 1
  • 6
  • 18