Hamid Ali
Hamid Ali

Reputation: 13

remote connection to phpmyadmin using php

http://164.138.211.154/phpmyadmin/index.php?db=database&token=token

///change database settings here
///database connection
$servername = "164.138.211.154";
$username = "user";
$password ="password";
$dbname="database";

/*

trying to connect to this phpmyadmin database(above is the link) using wamp(loclhost) and i am getting error

Warning: mysqli::__construct(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\PhpProjects\Orders\Read Csv file\check.php on line 38 Connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

i changed the username,pass,host address of php "config.inc" of my wamp server files but still not able to connect plz help me plz.

Upvotes: 0

Views: 1614

Answers (1)

Parantap Parashar
Parantap Parashar

Reputation: 2010

This is because you are trying to access a remote database secured with ssh.

You need to login over ssh using a ssh tunnel from your server using command line.

Setting up tunneling posted by @Ólafur Waage on Connect to a MySQL server over SSH in PHP

And this one for tunneling by @Sosy

shell_exec(“ssh -f -L 3307:127.0.0.1:3306 [email protected] sleep 60 >> logfile”);  
$db = mysqli_connect(’127.0.0.1′, ‘sqluser’, ‘sqlpassword’, ‘rjmadmin’, 3307);

Links are used from: answer by @kwarunek

Upvotes: 1

Related Questions