简体   繁体   中英

Load database from remote hosted server : phpmyadmin

I have offline version of a project and the same project updated online with large records of database , I want to access the database hosted on the server from the local host and my trials to do that:

No 1:

<?php

// mysql_connect('localhost', 'root', '');
// mysql_select_db('eghtml5_XXXX');
$dbserver="http://96.127.132.74:xxxx";


$username="xxxxx";
$password="xxxxx";

// $username="root";
// $password="";
$dbname="database_name";
$connection=mysql_connect("$dbserver","$username","$password")or die("could not     connect to the server");

mysql_select_db($dbname, $connection) or die("Error here");
mysql_query("SET NAMES utf8;");

mysql_query("SET CHARACTER_SET utf8;");
?>

and another trial to append this configuration at php.ini at the local host

$i++;
$cfg['Servers'][$i]['host']          = '96.127.132.74';
$cfg['Servers'][$i]['port']          = 'XXXX';
$cfg['Servers'][$i]['socket']        = '';
$cfg['Servers'][$i]['connect_type']  = 'tcp';
$cfg['Servers'][$i]['extension']     = 'mysql';
$cfg['Servers'][$i]['compress']      = FALSE;
$cfg['Servers'][$i]['auth_type']     = 'config';
$cfg['Servers'][$i]['user']          = 'xxxx';
$cfg['Servers'][$i]['password']      = 'ْْxxxx';

both ways haven't worked with me !

Check if the user you are trying to logon with is allowed to connect from locations that are not "localhost" or the IP of the online server.

And you'll have to check if port 3306 (MySQL STD Port) is open to connect from outside (might be a security issue)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM