Connect site from localhost to online database Is it possible?

0

The question is if I can connect a web saved in my localhost to a database that is hosted online, the idea is the following:

  

I have an online database with the necessary information so that   run my website, I also have registered the domain theeye.ml that   basically create an iframe of your localhost, I have usbwebserver (A   portable localhost) in several pendrives, the idea is that one starts   localhost with the pendrive and enter www.theeye.ml and you can run the   blog that is updated with the online database

In order to start the theeye.ml site, the pendrive with the localhost is necessary, but the database is not stored in the localhost but in an online hosting. I am a novice with mysql, Excuse ignorance and thank you

    
asked by Rosalino Rosa 04.11.2017 в 06:11
source

2 answers

0

Normally in your cPanel you have the addresses to which you can connect with Mysql if you use PHP 5+ I recommend you use mysqli:

$conexion = mysqli_connect("host","usuario","password","db");
    
answered by 04.11.2017 / 21:36
source
0
mysql_connect('elDominioDeLaBase.com','usuario','contraseña');

If possible, the only restriction that can happen is that there is a firewall that does not allow the connection to the remote host and that your SQL server has registered the authorized IPs to connect (you can allow the connection to any ip).

    
answered by 04.11.2017 в 06:14