0

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:

  • Editing my computer's host file
  • Editing xampp/phpmyadmin/config.inc.php a thousand different ways
  • Reinstalling XAMPP, reinstalling windows and XAMPP, manually uninstalling and reinstalling MySQL / PHP / PHPMyAdmin, etc.
  • Trying to learn about sockets and if there might be a MySQL socket error of some kind that I'm unable to diagnose. However, MySQL is running just fine and I can start a command line and log in as root and run MySQL commands. I can also run PHP PDO MySQL commands from my own localhost web apps without issue, so I'm almost positive the PHPMyAdmin install is to blame as opposed to MySQL itself.

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.

13
  • How does your httpd.conf look like? Commented Jul 15, 2013 at 20:24
  • anything special in your hosts file ? Commented Jul 15, 2013 at 20:25
  • @metareviewr These are all completely clean copies of Windows with no alterations to the hosts file. I've tried altering the hosts file countless ways and nothing helps. (Including adding the line 127.0.0.1 localhost, etc) Commented Jul 15, 2013 at 20:27
  • @Pieter These are all clean copies of XAMPP with no editing to httpd.conf or any other file. I've uploaded the default XAMPP httpd.conf here if you'd like to view it: junkgrave.com/httpd.conf.txt - thank you! Commented Jul 15, 2013 at 20:28
  • Something to do with your network then ?! Home network or university ? Commented Jul 15, 2013 at 20:29

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you so much for this solution, you're absolutely correct. Do you think I should raise a flag with XAMPP to have those controluser lines removed from their default phpmyadmin/config.inc.php? It doesn't break localhost connections for Windows XP, but it does for Windows 7 and Windows 8.
No problem. Not sure I always copy and paste my config.inc.php file into any new installation of PhpMyAdmin because I have like 10 servers setup with custom setting so I don't know what comes in the default one. Also FYI if you would have typed in that error you would have found quite a few answers: stackoverflow.com/questions/11506224/…
Good advice. Perhaps the problem was that I was searching with Google instead of with Stack Overflow's search function. I tried going through dozens of Stack Overflow answers related to similar questions but never came across the one you just linked to.
0

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.

10 Comments

I do not want a central MySQL server, nor do I want to access PHPMyAdmin over the network. I want to access it from either: 127.0.0.1/phpmyadmin or from localhost/phpmyadmin. Neither is currently possible. I can, however, access it just fine from: 192.168.1.12/phpmyadmin. That's the problem I'm trying to solve.
So, basically, I can easily access PHPMyAdmin from the network (and multiple other machines). I can also easily access it from the same machine it's on, but I have to type in the machine's network address instead of localhost. I want to be able to type in localhost (or 127.0.0.1) from the -same- machine.
is 127.0.0.1 and 192.168.1.12 the same machine?
Yes, absolutely. They're both my local machine. If you run cmd.exe and type ipconfig, it will tell you your network IP, such as 192.168.1.8, for instance. Then, if you open a browser, you should be able to go to 127.0.0.1 OR to 192.168.1.8, and they should both point to the same place: your local web server.
For some reason, PHPMyAdmin in particular is only accepting the connection from 192.168.1.12 and it isn't accepting it from 127.0.0.1.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.