我正在使用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