How to solve phpMyAdmin blank page and Mysql not connect to localhost issue?

Pick Language to Auto Translate:
AR | BG | CA | CS | DA | DE | EL | ES | FI | FR | HI | HR | ID | IT | IW | JA | KO | LT | LV | NL | NO | PL | PT | RO | RU | SK | SR | SL | SV | TL | UK | VI | ZH | ZH-TW

If you have a problem with phpMyAdmin where you just get a blank page or unable to connect to MySQL in Windows machine you will be glad to know that I have a solution that will save you a headache and time.

How to solve phpMyAdmin blank page and Mysql not connect to localhost issue?

I come across a strange issue with phpMyAdmin. I keep getting a blank page although MySQL is installed and running just fine.

I spent a few weeks on this and finally came across a solution to change "localhost" to "127.0.0.1", that temporary solve the phpMyAdmin issue but then when I try to access any CMS script it just won't connect to MySQL.

This issue of not connect to MySQL via localhost is a big headache! There are many posts provide some kind of solution but it does not work for me until I check out something and this is the key to the whole problem with phpMyAdmin and MySQL with localhost issue.

The problem is in newer Windows it supports IPv6 by default and thus when you ping localhost you will get "::1" instead of the normal 127.0.0.1 and the latest version of MySQL just does not know how to handle "::1" and thus it just refuses to allow a connection. Therefore you will get a blank page in phpMyAdmin and none of the CMS can connect to MySQL

SOLUTION!

The solution turn out to be very simple once I figure out what is the issue! You just edit the hosts file to comment out "::1" and only have localhost define to 127.0.0.1 and when you ping localhost it will only serve up 127.0.0.1 and MySQL will allow connection to if and thus phpMyAdmin and CMS will be able to connect to MySQL via localhost just fine.

Ideally, MySQL should be enhanced to allow connection from "::1" when there is IPv6 stack enable not just expect 127.0.0.1

I hope this post will help you save many weeks and headache!