Leng
Leng

Reputation: 2998

PHPMyAdmin Not Allowing Connection

I have installed clean copies of XAMPP on completely clean installs of multiple Windows 7 and Windows 8 machines in an attempt to get PHPMyAdmin to work on any computer with any set up and have not been able to.

All the machines exhibit the following strange error.

When attempting to connect to 127.0.0.1/phpmyadmin -or- localhost/phpmyadmin:

Error Message

But - if the machine has a local network IP of, say, 192.168.1.12, and I navigate my browser to: 192.168.1.12/phpmyadmin - it loads just fine with no error!

So, my computers can connect to PHPMyAdmin on themselves through the network, or to each other through the network just fine, but never from localhost.

This is the right section when I access PHPMyAdmin through the network like that: PHPMyAdmin details

What I've Tried:

I've spent many hours trying every possible fix I could find on online forums, including:

No matter what I do, I can always run PHPMyAdmin just fine from 192.168.1.x/phpmyadmin, but never from 127.0.0.1/phpmyadmin or localhost/phpmyadmin.

Please, someone, anyone - with any advice or pointers at all - help a frustrated coder out.

Thank you.

Upvotes: 0

Views: 3152

Answers (2)

Pitchinnate
Pitchinnate

Reputation: 7556

I think I see your issue. I think the issue is with your config.inc.php if you look at the error it says:

"Connection for controluser as defined in your configuration failed."

So I'm pretty sure your problem is coming because of these lines of code:

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';

For now try only keeping these lines in your config.inc.php and see if it works. You can either delete the rest or comment the rest out. Also you could try changing auth_type to 'cookie'.

/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

Based off the fact that the php page is coming up and phpmyadmin is giving you an error means it isn't a problem with your hosts file or you .conf file. My guess is you always copy and paste that same config.inc.php file so you are getting the same problem on every machine.

Upvotes: 1

Philipp
Philipp

Reputation: 15629

127.0.0.1 is the same as localhost and refers to your actual computer. If you try to connect to 127.0.0.1, phpMyAdmin tries to open a connection to the local MySQL Server(which only exists on the one machine, you installed it..)

If you want a central MySQL Server, you have to use the correct ip adress(can be determined with ifconfig/ipconfig) and use that one. Second, you have to allow foreign connection to this server. The default behavior is to only allow Connections from 127.0.0.1(which is only the MySQL Server machine). To allow root access from foreign machines, you have to edit the mysql.ini file which contains as far as i know a property which disallow connections to root from foreign machines.

Upvotes: 0

Related Questions