How can I connect to MySQL database online from localhost using php?
I have read through all I could laid my hands on but to no avail. I read through Connect to an online MySQL database from localhost, Connect to server database from localhost, Connect to server database from localhost and some as well but none of them helped.
I tried
$dbhost = 'infonetemonitor.com'; //$db['host'];
$dbuser = '****';//$db['user'];
$dbpass = '****';//$db['pass'];
$dbname = 'info1_quiz';//$db['dbname'];
//Mysqli
$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if (mysqli_connect_errno()) {
printf("MySQLi connection failed: ", mysqli_connect_error());
exit();
}
But this error was generated:
Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'info1_senetorial'@'41.58.56.26' (using password: YES) in C:\wamp64\www\COSTMI\includes\liveconnect.php on line 10
I thought it could be due to the fact that I didn't add an ip to Remote MySQL so I did but still nothing change.
In the database, I tried to grant privileges
GRANT ALL PRIVILEGES ON info1_quiz.* TO 'info1_senetorial'@'41.58.56.26' WITH GRANT OPTION;
but this error was displayed:
MySQL said:
1044 - Access denied for user 'infon10'@'localhost' to database 'mysql'
How can I go about it?