I am using XAMPP on my computer. My website is running fine on it. Now I uploaded my files to server using scp. Now I tried to change my connection parameter. I change it
<?php
$host ="104.236.227.173";
$username = "****";
$password = "******";
$database = "****";
@session_start();
?>
The host is the server on which my website is running.
But online I am unable to connect to database. I installed Lamp online. I have changed settings in my.conf. But it does not work. I have used the following command too
GRANT ALL ON `database`.* TO username@'%' IDENTIFIED BY 'password';
Please help me to solve this.
As shared using 'localhost' instead the IP address should do the trick. You're accessing the mysql on the same server as the php script is running. Unless the mysql server is configured to be available via IP address, 'localhost' is default behaviour. Glad it helped!