Good day everyone Not sure if this is the right place to ask this but im trying to connect to my database online "Control Panel of my hosting site" from my local machine basically the webpage is running locally. but i want the data to be fetch online. my question is do i need to configure my CP? if yes what do i need to change?

heres the config That im working with

        $mysql_hostname="***.***.*.***"; // IP ADD OF MY CP i also tried the webaddress
        $mysql_database="****";
        $mysql_user="****";
        $mysql_password="***";

        $con = mysqli_connect($mysql_hostname,$mysql_user, $mysql_password, $mysql_database);
        mysqli_select_db($con,"svcseuro_nwh")or die(mysql_error());
        date_default_timezone_set('Asia/Manila');

the original config on localhost is

    $mysql_hostname="localhost";
    $mysql_database="nwh";
    $mysql_user="nwh";
    $mysql_password="password";

    $con = mysqli_connect($mysql_hostname,$mysql_user, $mysql_password, $mysql_database);
    mysqli_select_db($con,"svcseuro_nwh")or die(mysql_error());
    date_default_timezone_set('Asia/Manila');

thanks neil

Recommended Answers

All 2 Replies

If your host allows remote MySQL, you'll have to add your local server's IP to their remote MySQL settings to their firewall allows the access. If you're host uses cPanel just look for the remote MySQL icon in the Database Tools section.

unfortunately remote mysql is not available on my Cpanel. i just ask my provider to whitelist and allow my ip so i can connect to mysql data.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.