MYSQL +无法从PHP连接
问题描述:
我正在使用nginx,PHP和MYSQL。我建立一个数据库和一个用户,我可以通过MySQL的CLI客户选择它:MYSQL +无法从PHP连接
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 52
Server version: 5.1.61-0+squeeze1 (Debian)
mysql> use cinema
Database changed
但是,似乎没有当我尝试从我的PHP脚本连接到它的工作:
<?php
$link = mysql_connect('localhost', 'root', '************');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
的输出是:
Could not connect: Access denied for user 'root'@'localhost' `(using password: NO)`
(* ** *当然是我真正的密码...)。
有没有人有一个想法,为什么说(using password: NO)
虽然我清楚地在我的代码中使用一个?
你的os和mysql安装如何? – 2012-04-28 21:50:11
旁注:不再推荐'mysql'。改为使用'MySQLi'或'PDO_MySQL'。 – KingCrunch 2012-04-28 21:50:21
查看我的帖子:服务器版本:5.1.61-0 + squeeze1(Debian) - 让我知道你是否需要了解更多细节! – Andrej 2012-04-28 21:51:05