PHP MySQLi 无法识别登录信息

2021-12-25 00:00:00 database-connection php mysqli

我无法使用 mysqli 类登录数据库.

I can't login to the database using mysqli class.

我收到下一个错误:

Warning: mysql_query(): Access denied for user 'www-data'@'localhost' (using password: NO) 

我有下一个代码:

$this->mysqlCon = new mysqli($siteConfig['db']['hostname'], $siteConfig['db']['username'], $siteConfig['db']['password'], $siteConfig['db']['database']);

var_dump() of $siteConfig['db'] 返回:

array(4) {
  ["hostname"]=>
  string(9) "localhost"
  ["username"]=>
  string(4) "root"
  ["password"]=>
  string(*) "***Censored***"
  ["database"]=>
  string(*) "***Censored***"
}

我的 VPS 正在运行 Debian 6 32 位.

My VPS is running Debian 6 32bit.

推荐答案

Warning: mysql_query()
             ^---------------------- notice something? :)

您似乎在代码中混淆了 mysqlmysqli.

You seem to be mixing up mysql and mysqli in your code.

相关文章