访问虚拟主机时拒绝SQL访问

时间:2014-11-10 03:02:55

标签: mysql sql iphone apache wamp

我试图在手机上访问我的localhost网站。我的主机文件设置如下:

的httpd的虚拟主机:

<VirtualHost *:80> 
DocumentRoot "C:\path"
ServerName 192.xxx.x.xx
</VirtualHost>

等/主机:

192.xxx.x.xx C:\path

上面的ip是使用ipconfig

获得的ip

当我尝试使用手机或笔记本电脑访问ip时,我收到MYSQL错误

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1045] 
Access denied for user 'username'@'localhost' (using password: YES)' in C:path/DatabaseDriverMysql.php

我也试过像这样设置xip.io路径:

<VirtualHost *:80> 
DocumentRoot "C:\path"
ServerName mysite.195.xxx.x.xx.xip.io
</VirtualHost>

但是在我的手机或笔记本电脑上访问它会产生同样的错误。

PS:我正在使用WAMP服务器。

1 个答案:

答案 0 :(得分:0)

虚拟主机定义很难完成,但这绝对是错误的

<VirtualHost *:80> 
DocumentRoot "C:\path"
ServerName 192.xxx.x.xx
</VirtualHost>

将其更改为

<VirtualHost *:80> 
DocumentRoot "C:/path"           <-- changed line
ServerName 192.xxx.x.xx
</VirtualHost>
相关问题