[thelist] Issues connecting PHPMyAdmin to MySQL

Max Schwanekamp lists at neptunewebworks.com
Tue Apr 25 00:56:32 CDT 2006

> From: Randal Rust
> I have a WAMP installation where I am having issues 
> connection to MySQL with PHPMyAdmin.
> MySQL is version 4.1 and PHPMyAdmin is 2.7.0-pl1. Everytime I 
> bring up PHPMyAdmin, I get this message:
> "phpMyAdmin tried to connect to the MySQL server, and the 
> server rejected the connection. You should check the host, 
> username and password in config.inc.php and make sure that 
> they correspond to the information given by the administrator 
> of the MySQL server."

Did you check the settings in config.inc.php in the root phpMyAdmin folder?
You should see these lines, the first batch having explanatory comments:
$cfg['Servers'][$i]['host']            = 'example.com';
$cfg['Servers'][$i]['port']            = '3306';
$cfg['Servers'][$i]['socket']          = '';
$cfg['Servers'][$i]['connect_type']    = 'tcp';
$cfg['Servers'][$i]['extension']       = 'mysql';
$cfg['Servers'][$i]['compress']        = TRUE;
$cfg['Servers'][$i]['controluser']     = '';
$cfg['Servers'][$i]['controlpass']     = '';
$cfg['Servers'][$i]['auth_type']       = 'config';
$cfg['Servers'][$i]['user']            = 'myusername';
$cfg['Servers'][$i]['password']        = 'mypassword';

The error sounds like you have auth_type set to 'config', user as 'root' but
have no password entered (i.e. "(using password: NO)".  Is that the case?
Assuming you're running MySQL locally, you can open up a command prompt and
test your connection:
C:\>mysql --host=example.com --user=myusername -p
Enter password: **********

Welcome to MySQL monitor etc etc.
N.B. If mysql is not in your PATH Environment variable, change to the MySQL
Server installation dir first, e.g. cd \Progr*\MySQL\MySQL Server 4.1\bin 

If you can connect OK via command prompt, then it's definitely just a
problem with config.inc.php.  IIRC in the latest releases of phpMyAdmin
don't come with config.inc.php, but rather you need to copy
config.default.php as config.inc.php and edit the config variables
accordingly.  Maybe WAMP is supposed to do this automagically, I dunno.  The
comments in that file are pretty complete though.

If you cannot connect via command prompt, then as Alex suggested, look into
the server privileges to be sure your local IP is allowed.  But your error
message suggests a config problem.

Max Schwanekamp

More information about the thelist mailing list