用127.0.0.1不能登录数据库,但是localhost可以登录数据库,这是怎么回事?回答正确的,我给高分,要详细!!

2024-11-02 22:26:08
推荐回答(2个)
回答1:

localhost公用的吧!一般的数据都可以用 127.0.0.1是登录必需知道sql默认端口
在sql2005 默认端口是1433
127.0.0.1,1433 就可以了

回答2:

还没碰到过这种情况,在这个C:\WINDOWS\system32\drivers\etc目录下看看
# 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
192.168.3.39 www.zyzgoffice.com
上面就是域名和ip的绑定,你进去看看是不是这样写的就OK了