0
當我得到一個錯誤信息我把這個直接從php.netmysqli的連接()使用IP地址
$mysqli = new mysqli("localhost", "user", "password", "database");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
echo $mysqli->host_info . "\n";
$mysqli = new mysqli("127.0.0.1", "user", "password", "database", 3306);
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
echo $mysqli->host_info . "\n";
我的輸出是像這樣:
通過UNIX套接字本地主機
我問題是...爲什麼我在嘗試使用第二種方法時收到錯誤消息。
無法連接到MySQL:(1045)訪問被拒絕的用戶 '* '@' 127.0.0.1'(使用密碼:YES)
這個問題不顯示*任何*研究努力。 –