Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
540 views
in Technique[技术] by (71.8m points)

php - MySQL working with 127.0.0.1 but not working with localhost?

I have a strange problem in php MySQL:

php connects with 127.0.0.1 but not with localhost.

How to solve this issue?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try ping localhost in a command line, it may be resolving to ::1: the IP6 equivalent to 127.0.0.1

To fix it, add (or uncomment) the line:

   127.0.0.1       localhost

in C:WINDOWSsystem32driversetchosts


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...