好莱坞 全套 百度云:数据库连接问题 127.0.0.1和localhost有什么区别?

来源:百度文库 编辑:中科新闻网 时间:2024/03/28 18:09:55
在我得.net2003里,字符串是localhost就联不上SQLSERVER,而127.0.0.1或者"."就可以连上,为什么?这么解决?
我得host 文件内容是:127.0.0.1 localhost
没有问题!

日,现在又没问题啦,哪种都可以连上。
就没人能解释以下吗???????????????

此问题无满意答案,没有人能解释得清楚。。。。。。。
但要多谢各位得回答,分数就不浪费啦。。。。。。。。

你设置的主机名叫localhost.localdomain吧?
localhost好象是用127.0.0.1来登陆,也是默认登陆
主机名是利用本机的IP地址登陆,理论上可以删,但最好还是不要删localhost.localdoamin 是FQDN localhost 是简写。http://localhost

http://127.0.0.0 说的都是本机的IP地址

一些特殊的IP地址:
1.IP地址127.0.0.1:本地回环(loopback)测试地址
2.广播地址:255.255.255.255
3.IP地址0.0.0.0:代表任何网络
4.网络号全为0:代表本网络或本网段
5.网络号全为1:代表所有的网络
6.节点号全为0:代表某个网段的任何主机地址
7.节点号全为1:代表该网段的所有主机

可能IP解悉出了问题,如果直接写IP呢? 比如你的IP是192.168.2.1那么用http://192.168.2.1试一下

你 hosts 文件没有定义

[C:\WINDOWS\system32\drivers\etc]type hosts

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost

[C:\WINDOWS\system32\drivers\etc]

本人力挺 布鱼 的回答 (local) ,localhost, 127.0.01, 或者你网卡上的IP
或者 SQL server的别名 都对的

我的全部通行无阻

localhost代表你本地的DNS
DNS代表的是域名系统的意思。
当你输入你的域名的时候,就会向DSN主机进行查询,然后返回响应的IP地址。LOCALHOST返回的是127.0.0.1则代表的是你本地的IP
你也可以在你的局域网内建立自己的DNS服务器,也就是在你的局域网把域名www.baidu.com的定向IP设置为你自己喜欢的IP地址。但是当在你本地的DNS服务器找的到的是后他就会上外网上的DNS主机上查询,直到找回IP地址。