これをW3Schoolsからコピーしました。実行しようとすると、エラーが表示されます。私はMySQLには本当に新しいので、私はこれを修正しようとしていますが、私は方法を知らない。接続エラーMySQL
ERROR:
Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: YES) in C:\xampp\htdocs\Informatica\test.php on line 10 Connection failed: Access denied for user 'username'@'localhost' (using password: YES)
<html>
<body>
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
</body>
</html>
として
エラーは、 'username'ユーザーのために使用したパスワードが間違っていることを意味します。 ;) – Labu
あなたのパスワードが無効です –
LAMP/WAMP環境を設定したばかりの場合は、おそらくユーザ名とパスワードの両方に 'root'があるでしょう。 –