Mysql – Added password to root, locked out of phptheadmin

MySQLphpmyadmin

Using phpmyadmin, I changed the password for user root (both the localhost entry and the 127.0.0.1 entry) from blank to "password". I was then locked out of phpmyadmin, getting the 1130 error: "Host ‘localhost’ is not allowed to connect to this MySQL server"

I did a bunch of searching on stackoverflow and found a solution that gets me back into phpmyadmin:

I simply add the line "skip-grant-tables" to the [mysqld] section of "my.ini".

But that seems like a bad solution, like I am just circumventing the problem rather than fixing it. I also tried another solution in which I add my username and password to "config.inc.php" in this section:

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

but that has no effect. So my questions are:

  1. Why would adding a password to root lock me out of phpmyadmin in the first place? Shouldn't it just bring me to a login screen?

  2. What is the proper way to fix this?

Thanks
Jonah

Best Answer

I tried several of the suggested changes to get back into phpMyAdmin, and they did not work. However, while going through the config file, I came across this statement:

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

Simply insert the password for the root user between the single quotes, then save the file. You should be able to get back in.

Related Topic