I been using
ssh tunnel to bypass firewall of remote mysql server. On my Ubuntu 12.04 installation, it works via the terminal and it works when using a program called mysql workbench. However, that program freezes often and I want to try phpmyadmin as an alternative.
However, I cannot connect to remote server using
ssh tunnel on phpmyadmin, albeit I can connect locally.
These are the steps I've tried:
1) Open a tunnel, listening on localhost:3307 and forwarding everything to xxx.xxx.xxx.xxx:3306 (used 3307 because MySQL on my local machine uses the default port 3306):
ssh -L 3307:localhost:3306
[email protected]
So now I have the port for tunnel open and I have my local mysql installation default port:
$ netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:3307 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
...
2) Now I can easily connect to remote server via localhost using the terminal:
$ mysql -u user.name -p -h 127.0.0.1 -P 3307
Notice that I expicitly identify 3307 as the port, so traffic forwards to the remote server, and hence it logs me in to the remote server.
Unfortunately, the localhost/phpmyadmin local login interface doesn't allow you to specify a port option. So I modify the config-db.php file and change the $dbport variable to 3307, under the impression that the phpmyadmin interface will now work with port 3307:
$ sudo vim /etc/phpmyadmin/config-db.php
$dbport='3307';
Then I restart the mysql server.
Unfortunately, it didn't work. When I use the remote credentials to login, it gives me error:
#1045 Cannot log in to the MySQL server