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

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 by 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 post 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 support 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 refuse to allow 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 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!