【发布时间】:2015-12-29 08:09:55
【问题描述】:
尝试从webmatrix中的php文件连接mysql数据库时出现错误,详细信息如下
这是 PHP 文件:
<!DOCTYPE html>
<html>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "password";
$database = "image" ;
// Create connection
$conn = new mysqli($servername, $username, $password);
echo "Connected successfully";
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
</body>
</html>
这是 web.config 文件:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<connectionStrings>
<add connectionString="Server=localhost;Database=image;Uid=root;Pwd=password" name="image" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
</configuration>
这是我得到的错误:
HTTP Error 403.14 - Forbidden
Most likely causes:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
More Information:
This error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. This setting may be disabled on purpose to secure the contents of the server.
【问题讨论】:
-
$password = "密码"; ??