我遇到了此連接的問題。我也做 「授予所有」 此用戶mysql_connect()訪問被拒絕
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'kristian'@'localhost' (using password: YES) in connection.php on line 8
Failed to connect to MySQL: Access denied for user 'kristian'@'localhost' (using password: YES)
的connection.php
<?php
define('DB_HOST', 'localhost');
define('DB_NAME', 'email');
define('DB_USER', 'kristian');
define('DB_PASSWORD', 'password');
$con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
$db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error());
?>
順便說一句,你爲什麼使用MySQL?它已被棄用。改爲使用[mysqli](http://sg3.php.net/mysqli)。 – Huey
我用mysqli,它仍然給我一個錯誤 – user3064038
或使用pdo它是更好 – 2014-01-12 08:00:43