Connect to Remote Database with PhpMyAdmin

on Database Server:
apt-get install mysql-server mysql-client

Backup original configuration:
cp /etc/mysql/my.cnf /etc/mysql/my.cnf_orig

Let mysql server listen on all interfaces:
grep -l bind-address /etc/mysql/my.cnf | xargs sed -i -e 's/bind-address/#bind-address/'

Restart mysql server
/etc/init.d/mysql restart

Check if MySQL binds on every interface
netstat -tap

it should look like this:
tcp 0 0 *:mysql *:* LISTEN 2487/mysqld

Now give root user logon permission from Webserver where phpmyadmin is running
mysql -u root -p
mysql> use mysql;
mysql> update user set host=’WEBSERVER-IP’ where host=’127.0.0.1′ and user=’root’;
mysql> flush privileges;

Restart mysql server
/etc/init.d/mysql restart

On Webserver:
apt-get install apache2 php5 phpmyadmin

Edit /etc/phpmyadmin/config-db.php and set the variables
$dbuser='root';
$dbpass='R00tPassW0rd';
$dbname='mysql';
$dbserver='DBSERVER-IP';
$dbport=''; // leave blank if mysql runs on default port

Open your Browser and point to http://yourwebserver/phpmyadmin

Leave a Reply

Your email address will not be published. Required fields are marked *

Protected by WP Anti Spam