0

I am trying to connect my database with this statement:

<?php
//database
define('DB_HOST', 'localhost:3306');
define('DB_USERNAME', 'shira-23');
define('DB_PASSWORD', '1234');
define('DB_NAME', 'mydb');

//get connection
$mysqli = mysqli_connect(DB_HOST, DB_USERNAME, DB_PASSWORD) or die('Not connected : Ah sh*t ' . mysqli_connect_error());
?>

and get this warning:

mysqli_connect(): (HY000/1045): Access denied for user 'shira-23'@'localhost' (using password: YES)

Dharman
  • 30,962
  • 25
  • 85
  • 135
shira_b
  • 1
  • 1
  • 2
    Does this answer your question? [Warning: mysqli\_connect(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: YES)](https://stackoverflow.com/questions/25174183/warning-mysqli-connect-hy000-1045-access-denied-for-user-usernameloca) – Dharman Sep 24 '20 at 15:06
  • Did you try to set define('DB_HOST', 'localhost'); without the port number ? – Inazo Sep 24 '20 at 15:08
  • Have you checked if the user `shira-23` has the right for database `mydb` ? – Marcello Perri Sep 24 '20 at 15:20
  • i think wrong password or username – Jerson Sep 24 '20 at 15:51

0 Answers0