RT.想问下mysql权限问题..
昨天装了discuz.那时候用的主机命为$dbhost = 'localhost'能访问discuz论坛.但今天突然访问不了.后来经自己去网上查了不少资料.发现可以用$dbhost = '127.0.0.1'去访问discuz.也修改了C:\WINDOWS\system32\drivers\etc的host文件.添加了127.0.0.1  localhost这条语句.
但想问下怎么改.可以用回localhost去访问discuz论坛.
同时也想问下localhost和127.0.0.1有什么区别.
期间只是用过windows优化大师优化过系统而已.但个人感觉应该和优化无关.希望各位大大能帮忙.解决下小弟的问题..先谢谢了.

解决方案 »

  1.   

    系统默认情况下会将 localhost 解析到地址 127.0.0.1 如果你机器不能解析到,那就是说明你的 host文件被动过,所以你要自己建立一个解析到 127.0.0.1 的域名hosts 为本地DNS
      

  2.   

    1、打开Internert信息管理查看IIS是否启动,且默认网站时候已经开启;  
    2、打开http://127.0.0.1 看是否能访问IIS的默认网页,能访问则说明IIS已经成功安装到电脑上,可能是无法解析localhost;  
    3、开始--命令(cmd)--ping localhost,看是否能ping通,从127.0.0.1上返回信息,如果成功则说明可以解析localhost;  
    4、如果上一步不成功,则用记事本打开C:\WINDOWS\system32\drivers\etc\hosts文件,看里面是否有包含:127.0.0.1 localhost ,如果没有则将其添加进去,再查看能否访问localhost。  
    5、尝试将网站的主目录指向另一个目录或新建一个虚拟目录,并在该新目录创建一个新的网页文件,如index.html,然后将其加到默认网站的"文档"项中作为默认访问的网页,重新输入网址:http://localhost,看否能访问。  
    6、还是不行的话将IIS卸载掉,重新再安装一次。  还有一种情况也会导致"无法访问localhost, 但可以访问127.0.0.1",这是我所遇到的,返回的信息如下:  
    The page cannot be displayed  
    There is a problem with the page you are trying to reach and it cannot be displayed.  
    --------------------------------------------------------------------------------  Please try the following:  
    Click the Refresh button, or try again later.  Open the Web site home page, and then look for links to the information you want.  
    If you believe you should be able to view this directory or page, please contact the Web site administrator by using the e-mail address or phone number listed on the Web site home page.  
    10061 - Connection refused  
    Internet Security and Acceleration Server  --------------------------------------------------------------------------------  
    Technical Information (for support personnel)  Background:  
    The server you are attempting to access has refused the connection with the gateway. This usually results from trying to connect to a service that is inactive on the server.  ISA Server: XWProxy1.star-net.cn  
    Via:  Time: 2008-10-14 0:50:36 GMT  
    这是因为我所在部门的电脑只能通过局域网内主机做代理服务器来访问网络,在设置代理服务器的时候,未将"对于本地址不使用代理服务器(B)"打钩,导致访问本地地址的时候也实验代理服务器,localhost只能被本地主机解析,代理服务器不能解析其他主机的localhost。只要将 Internet选项--链接--局域网设置--代理服务器 下的那个√打上就可以了
      

  3.   

    ping http://localhost
    返回 Reply from ::1: time<1ms是不是有安装ipv6 协议ipv6 协议导致localhost无法解析成127.0.0.1所以才会出这个问题。卸掉之前安装的ipv6协议,重启看下行不行
      

  4.   

    回7L的话..我用的是apache2.2.4..没有IIS..
    然后我用的是xp系统sp3版..应该没IPV6协议吧..
    至于你那个ping http://localhost不行..
    显示下面那句话:
    C:\Documents and Settings\xiaosen>ping http://localhost
    Ping request could not find host http://localhost. Please check the name and try
     again.
      

  5.   

    4、如果上一步不成功,则用记事本打开C:\WINDOWS\system32\drivers\etc\hosts文件,看里面是否有包含:127.0.0.1 localhost ,如果没有则将其添加进去,再查看能否访问localhost。
    =======================================================
    这一句话我已经加了.具体可以看下6L我回复的帖子...
      

  6.   


    我一直都是用ping www.xxx.com  的...