Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to connect online mysql database server from local wamp server using php?

Tags:

php

mysql

I need to connect my online mysql database from local wamp/xampp server using php

I need to update some table in my online phpmyadmin database from my local phpmyadmin database , It is possible ? my local machine have internet connection ,

like image 964
Mujeeb Iqbal Avatar asked Oct 20 '22 21:10

Mujeeb Iqbal


1 Answers

To connect to remote server from your local machine you need some already granted privileges on that server itself with your IP and an username with a prespecified password. So you can't do it without their permission.

Check this answer

After that you are allowed to create connection to that remote database server using the following syntax:

$hostname='www.facebook.com';// Remote database server Domain name.
$username='username';// as specified in the GRANT command at that server.
$password='password';// as specified in the GRANT command at that server.
$dbname='testdb';// Database name at the database server.
$mysqli = new mysqli($hostname, $username, $password, $dbname);
like image 194
Rajesh Paul Avatar answered Oct 27 '22 10:10

Rajesh Paul