Page 1 of 1

PhpMyAdmin Can't Connect to MySQL

PostPosted: 27. September 2006 02:51
by commonwealthman
Every time I install XAMPP in Windows (to use as a testing server on my machine as localhost) and follow the documentation to create a password for the root user, I get the following error message:

Welcome to phpMyAdmin 2.8.2.4

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.

Error
MySQL said:

Cannot connect: invalid settings.
Open new phpMyAdmin window


I've uninstalled/reinstalled a bunch of times, and can't make any progress. I've made sure the host, user and password match in the config.ini.php file, but it has no effect. Any help you can give would be much appreciated.

PostPosted: 27. September 2006 03:00
by Izzy
Can you paste the relevant part of the config.inc.php?

Here is mine and it works fine:
Code: Select all
$cfg['Servers'][$i]['host']          = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port']          = '';          // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket']        = '';          // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension']     = 'mysql';     // The php MySQL extension to use ('mysql' or 'mysqli')
$cfg['Servers'][$i]['compress']      = FALSE;       // Use compressed protocol for the MySQL connection
                                                    // (requires PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser']   = 'pma';          // MySQL control user settings
                                                    // (this user must have read-only
$cfg['Servers'][$i]['controlpass']   = '';          // access to the "mysql/user"
                                                    // and "mysql/db" tables).
                                                    // The controluser is also
                                                    // used for all relational
                                                    // features (pmadb)
$cfg['Servers'][$i]['auth_type']     = 'cookie';      // Authentication method (config, http or cookie based)
$cfg['Servers'][$i]['user']          = 'root';      // MySQL user
$cfg['Servers'][$i]['password']      = '';          // MySQL password (only needed
                                                    // with 'config' auth_type)
$cfg['Servers'][$i]['only_db']       = '';          // If set to a db-name, only
                                                    // this db is displayed in left frame
                                                    // It may also be an array of db-names, where sorting order is relevant.
$cfg['Servers'][$i]['verbose']       = '';          // Verbose name for this host - leave blank to show the hostname


There is a mySQL error log file in:
xampp\mysql\data\(yourname).err which might hold some clues.

PostPosted: 27. September 2006 11:23
by commonwealthman
Shazam! Right away I noticed that the auth_type on line 68 was set to config, rather than cookie, as in the block of code you offered, Izzy. Once I changed it to cookie, the connection was made and everything works fine. Oddly enough, I had earlier installed everything exactly the same way on a Sony Vaio laptop (I was experiencing the no connect problem on a Gateway desktop) and line 68 was set correctly to cookie on the laptop. Why it didn't install that way on the desktop is beyond me. Anyway, now I know what to do. Thanks, Izzy!