我正在尝试连接另一个网站数据库,并希望删除一个表。但是我真的没有那样做。下面是我的代码:
<?php
$host = "http://website.com";
$username = "databaseUsername";
$password = "password";
$dbname = "databaseName";
try {
$conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// sql to delete a record
$sql = "DELETE FROM wphe_links";
// use exec() because no results are returned
$conn->exec($sql);
echo "Record deleted successfully";
} catch(PDOException $e) {
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>
当我尝试连接时,错误日志为:
SQLSTATE [HY000] [2059]无法加载插件http: /usr/lib64/mysql/plugin/http.so:无法打开共享对象文件:否 这样的文件或目录
谢谢。
答案 0 :(得分:0)
除了http://的错误之外,很可能您的远程服务器未配置为进行远程连接:)