Title rewritten to: WARNING: mysqli_connect(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: yes)
P粉667649253
2023-08-21 12:59:10
<p><br /></p><blockquote>
<p>Warning: mysqli_connect(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: yes) in C: Users xampp htdocs PHP_Login_Script config.php on line 6 </p> ;
</blockquote>
<p>I get the above error on localhost even though my config file looks like this: </p>
<pre class="brush:php;toolbar:false;"><?php
define("DB_HOST", "localhost");
define("DB_USER", "root");
define("DB_PASSWORD", "");
define("DB_DATABASE", "databasename");
$db = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);</pre>
<p>This used to work, but no longer does. Is there something wrong with this code, or does it not work now? </p>
If you are using wamp, please update
Change to your machine IP address (mine is 192.168.0.25);
You can find it by typing ipconfig in the console on Windows or ifconfig on Mac/Linux.
This username, host and password combination does not allow connection to the server. Please verify the permissions table on the server (reload authorization if necessary) and make sure you are connecting to the correct server.