MySQL working with 127.0.0.1 but not working with localhost?(MySQL 使用 127.0.0.1 但不使用 localhost?)
问题描述
我在php MySQL中有一个奇怪的问题:
I have a strange problem in php MySQL:
php 与 127.0.0.1
连接,但不与 localhost
连接.
php connects with 127.0.0.1
but not with localhost
.
如何解决这个问题?
推荐答案
localhost 必须在你的 hosts 文件中定义,它在 Windows 和大多数操作系统上是默认的.
localhost must be defined in your hosts file, which it is by default on Windows and most OSs.
检查以下文本文件,看看发生了什么:
Check the following text file and see what's up:
C:WINDOWSsystem32driversetchosts
请注意,hosts"是文件,没有扩展名,它不是文件夹.这个文件应该几乎是空的,如果你看到条目要么你的 AV/垃圾邮件拦截器添加了大量指向 127.0.0.1 的条目,要么讨厌的恶意软件在那里写了垃圾,尽管新条目低于旧条目.localhost 应该是该文件中的第一个条目.
Please note "hosts" is the file, no extension, it's not a folder. This file should be pretty much empty, if you see entries either your AV/spam blocker added a ton of entries that point to 127.0.0.1 or nasty malware has written garbage in there, despite, newer entries are below older ones. Localhost should be the first entry in that file.
这篇关于MySQL 使用 127.0.0.1 但不使用 localhost?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL 使用 127.0.0.1 但不使用 localhost?


- Mod使用GET变量将子域重写为PHP 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- Laravel 仓库 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01