Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to external server by using phpMyAdmin

I have phpMyAdmin installed on my local machine. How can I make it connect to an external server?

like image 915
Neveen Avatar asked Nov 12 '09 13:11

Neveen


People also ask

How do I access phpMyAdmin externally?

Access the phpMyAdmin console through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin. Log in to phpMyAdmin by using the following credentials: Username: root. Password: application password.

How do I connect to MySQL server from phpMyAdmin?

Create MySQL Database at the LocalhostOpen your browser and go to localhost/PHPMyAdmin or click “Admin” in XAMPP UI. Now click Edit privileges and go to Change Admin password, type your password there and save it. Remember this password as it will be used to connect to your Database.


2 Answers

In the config file, change the "host" variable to point to the external server. The config file is called config.inc.php and it will be in the main phpMyAdmin folder. There should be a line like this:

$cfg['Servers'][$i]['host'] = 'localhost'; 

Just change localhost to your server's IP address.

Note: you may have to configure the external server to allow remote connections, but I've done this several times on shared hosting so it should be fine.

like image 163
DisgruntledGoat Avatar answered Oct 14 '22 23:10

DisgruntledGoat


To set up an external DB and still use your local DB, you need to edit the config.inc.php file:

On Ubuntu: sudo gedit /etc/phpmyadmin/config.inc.php 

The file is roughly set up like this:

if (!empty($dbname)) {      //Your local db setup       $i++; } 

What you need to do is duplicate the "your local db setup" by copying and pasting it outside of the IF statement I've shown in the code below, and change the host to you external IP. Mine for example is:

$cfg['Servers'][$i]['host'] = '10.10.1.90:23306'; 

You can leave the defaults (unless you know you need to change them)

Save and refresh your PHPMYADMIN login page and a new dropdown should appear. You should be good to go.


EDIT: if you want to give the server a name to select at login page, rather than having just the IP address to select, add this to the server setup:

$cfg['Servers'][$i]['verbose'] = 'Name to show when selecting your server';  

It's good if you have multiple server configs.

like image 34
Jarrod Avatar answered Oct 15 '22 01:10

Jarrod