I'm working on a MAC in a MAMP environment.
so when i try to connect to the database i get this error
$this->db = mysqli_connect('localhost', 'root', '');
I can log in with PhpMyAdmin as the root user.
mysqli_connect(): (28000/1045): Access denied for user
'root'@'localhost' (using password: YES)
my root user is set like this
global rights: ALL PRIVILEGES
Does anyone know how to resolve this problem?
The PHP Manual here says about the password field:
If not provided or NULL, the MySQL server will attempt to authenticate the user against those user records which have no password only. This allows one username to be used with different permissions (depending on if a password as provided or not).
So, either do
mysqli_connect($host, $user); or
mysqli_connect($host, $user, null);
you have to call mysqli_connect without a password parameter, else php tries to authenticate the user using the empty string as password. try
only, withouth the