“Connect failed: Access denied for user ‘root’@’localhost’ (using password: YES)” from php function

  • mysql -u root -p -h localhost
  • CREATE USER 'francesco'@'localhost' IDENTIFIED BY 'some_pass';
  • CREATE DATABASE shop;
  • GRANT ALL PRIVILEGES ON shop.* TO 'francesco'@'localhost';
  • quit;
  • mysql -u francesco -p -h localhost
  • source shop.sql;
  • $conn = new mysqli("localhost", "francesco", "some_pass", "shop");
  • Reference :

Reference :
Stackoverflow
Stackoverflow [error 1045]

Leave a Reply

Your email address will not be published. Required fields are marked *