Title rewritten to: WARNING: mysqli_connect(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: yes)
P粉667649253
P粉667649253 2023-08-21 12:59:10
0
2
472
<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>
P粉667649253
P粉667649253

reply all(2)
P粉933003350

If you are using wamp, please update

define("DB_HOST", "localhost");

Change to your machine IP address (mine is 192.168.0.25);

define("DB_HOST", "192.168.0.25");

You can find it by typing ipconfig in the console on Windows or ifconfig on Mac/Linux.

P粉505450505

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template