我有一个外部WordPress文件,我试图连接到我的WordPress数据库和另一个不是WordPress的数据库。
下面是该文件中的代码:
include(\'/var/www/html/wp-load.php\'); // WP connection
define ("DB_HOST", "localhost");
define ("DB_USER", "mysqluser");
define ("DB_PASS",\'password123\');
define ("DB_NAME","jobs");
try {
$dsn = "mysql:dbname=".DB_NAME.";host=".DB_HOST;
$dbh = new PDO($dsn, DB_USER, DB_PASS);
return $dbh;
} catch (PDOException $e) {
echo \'Connection failed: \' . $e->getMessage();
}
以下是我在连接WordPress数据库时遇到的错误:
Connection failed: SQLSTATE[HY000] [1045] Access denied for user \'wordpress\'@\'localhost\' (using password: YES)
我怎样才能解决这个问题?