Im using LEMP (Ubuntu Linux server, Nginx, Mysql, PHP) in my machine
I have followed this tutorial to set it up https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04
I can access mysql using command line (mysql -u user -p)
but if i run the php file in the commend line, or load it in the browser I get the following error
running the file in command line
php index.php
PHP Notice: PHP Warning: mysqli_connect(): (HY000/1045): Access denied for user
'my_username'@'localhost' (using password: YES) in index.php on line 13
PHP code
$localhost = "localhost";
$username = "my_username";
$pass = "my_password";
$database = "my_database";
$con = mysqli_connect($localhost, $username, $pass, $database) or die("not
connect". mysqli_connect_error());
This answers didnt really help me MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES) I think my problem is that i need to enable mysql to allow php communications some how?