PHPMyAdmin doesn't connect after root password change
Asked Answered
I

4

8

I installed Xampp (for Windows). I was happily using it with its all features.

Then I wanted to change MySql password. I set a randomly generated password (rCZ4Xnz78zbLY2Vh). Then PHPMyAdmin stopped logging in. It started to give the following error message, and it is the same ever since:

Error

MySQL said:
Cannot connect: invalid settings.

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection.
You should check the host, username and password in your configuration and make sure that
they correspond to the information given by the administrator of the MySQL server.

Then I edited the `config.inc.php" file of PHPMyAdmin, and made its contents exactly as below:

<?php

/* Servers configuration */
$i = 1;
$cfg['Servers'][$i]['host']         = '127.0.0.1';
$cfg['Servers'][$i]['port']         = '3306';
$cfg['Servers'][$i]['ssl']          = FALSE;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension']    = 'mysql';
$cfg['Servers'][$i]['compress']     = FALSE;
$cfg['Servers'][$i]['controluser']  = 'root';   
$cfg['Servers'][$i]['controlpass']  = 'rCZ4Xnz78zbLY2Vh';
$cfg['Servers'][$i]['auth_type']    = 'config';
$cfg['Servers'][$i]['user']         = 'root';
$cfg['Servers'][$i]['password']     = 'rCZ4Xnz78zbLY2Vh';
$cfg['Servers'][$i]['nopassword']   = TRUE;

/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold']     = 50;
$cfg['Servers'][$i]['bs_repository_threshold']  = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout']     = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold']    = '32M';

/* Other settings */
$cfg['blowfish_secret'] = '';
$cfg['DefaultCharset']  = 'utf-8';
$cfg['UploadDir']       = '';
$cfg['SaveDir']         = '';

?>

But I was able to connect to the MySql servier via command line by the same password .

C:\Users\hkBattousai>mysql.exe --user=root --password=rCZ4Xnz78zbLY2Vh
mysql.exe: Unknown OS character set 'cp857'.
mysql.exe: Switching to the default character set 'latin1'.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Then I removed the password via the command line interface:

user-password-removed

I also removed password from the config.inc.php file. The relevant lines in that file are now:

$cfg['Servers'][$i]['controluser']  = 'root';
$cfg['Servers'][$i]['controlpass']  = '';
$cfg['Servers'][$i]['user']         = 'root';
$cfg['Servers'][$i]['password']     = '';

Currently, it is strange but, I can connect with the password I deleted, but I cannot connect with empty password:

C:\Users\hkBattousai>mysql.exe --user=root --password=rCZ4Xnz78zbLY2Vh  // Connects
C:\Users\hkBattousai>mysql.exe --user=root --password=                  // Error given

I want to assign another random password to this user, and I want to access my database via PHPMyAdmin, as I did within the fresh Xampp installation before. What should I do? I'm really confused and I need your help.

It is like the config.inc.php file contents are ignored. I copied it from the template file config.sample.inc.php and altered its contents. It is now located in the directory \Xampp\phpmyadmin\.


Versions:

Xampp   : 3.1.0
MySQL   : 5.5.27
PHP     : 5.4.7
Apache  : 2.4
Windows : 7 Ultimate x64 SP1
Investigator answered 22/10, 2012 at 11:15 Comment(0)
I
37

You need to edit the config.inc file in the phpMyAdmin directory (probably C:\xampp\phpMyAdmin) and change this line to match the password you entered for root in phpMyAdmin.

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

Important answered 11/9, 2013 at 5:26 Comment(3)
Thank you for your simple straightforward answer! I for the life of me could not figure out which config file had the info I needed and I was struggling to search it on Google cause I didn't exactly know what I was looking for! Now I can continue my classwork though as I am no longer locked out of my database.Vasomotor
You are very welcome. I was equally frustrated when I had this problem.Important
I don't use Xampp anymore. Now I use Vagrant, you might want to look into it if your target environment is Linux.Important
O
4

If you have installed WAMP, go to the [wamp root]\apps[phpmyadmin installation] and find the file config.inc.php. Then you have the change the following entry to the new password of the root user.

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

save the file and don't forget to restart WAMP services. Now it should work as a charm :)

Otto answered 19/12, 2013 at 7:16 Comment(0)
T
0

You need to specify the actual password. Not encrypted password in config file

Trituration answered 22/10, 2012 at 13:7 Comment(1)
The string "rCZ4Xnz78zbLY2Vh" is not a hash of the password; it is the password itself.Investigator
A
0

Here is the solution for Windows machine: When you changed the root passord to let's say admin and now when you access http://localhost/phpmyadmin you see following screen enter image description here

Open XAMPP_SETUP/phpMyAdmin/config.inc.php file change config to cookie and add the password. enter image description here enter image description here And again access the http://localhost/phpmyadmin !!

Alyssaalyssum answered 17/10, 2019 at 11:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.