views:

2863

answers:

2

I issued a command of:

DROP USER 'root'@'localhost'; GRANT ALL PRIVILEGES ON . TO 'root'@'%';

...in PhpMyAdmin. Immediately after the execution, I was forced out PhpMyAdmin. I got:

error

#1130 - Host 'localhost' is not allowed to connect to this MySQL server,

how to resolve my problem?

+1  A: 

Use the IP instead:

DROP USER 'root'@'127.0.0.1'; GRANT ALL PRIVILEGES ON . TO 'root'@'%';

For more possibilities, see this link.

To create the root user, seeing as MySQL is local & all, execute the following from the command line (Start > Run > "cmd" without quotes):

mysqladmin -u root password 'mynewpassword'

Documentation, and Lost root access in MySQL.

OMG Ponies
Where to issue/execute this command?
Steven
From PHPMyAdmin, logged in as a user other than root with the appropriate permissions.
OMG Ponies
I can not log in PHPMyAdmin
Steven
Now that's a problem. Can you give some details on the setup - can you access the box MySQL is on, either by Remote Desktop or SSH/etc?
OMG Ponies
MySQL is on my local machine.
Steven
That's good news - windows, linux or other? There's MySQL command line, or MySQL Administrator if you haven't installed it already: http://dev.mysql.com/downloads/gui-tools/5.0.html
OMG Ponies
I am using Windows, and I have installed MySQL Administrator.
Steven
The problem is, I can not log in MySQL Administrator.
Steven
Yeah, I just saw the comment about possibly not having a user with similar permissions.
OMG Ponies
Windows cannot find 'mysqladmin'.Make sure you typed the name correctly,and then try again.To search for file,click the start button,and then click search.
Steven
A: 

Find the file "config.inc.php" under your phpMyAdmin directory and edit the following lines:

$cfg['Servers'][$i]['auth_type'] = 'config'; // config, http, cookie

$cfg['Servers'][$i]['user'] = 'root'; // MySQL user

$cfg['Servers'][$i]['password'] = 'TYPE_YOUR_PASSWORD_HERE'; // MySQL password

Note that the password used in the 'password' field must be the same for the MySQL root password. Also, you should check if root login is allowed in this line:

$cfg['Servers'][$i]['AllowRoot']     = TRUE;        // true = allow root login

This way you have your root password set.

Haitham Sweilem