Tested on ubuntu 10.4
Edit /etc/ssh/sshd_config on your local machine
Add:
AllowTcpForwarding yes
GatewayPorts yes
restart sshd
sudo /etc/init.d/ssh restart
Edit /etc/mysql/my.cnf on remote machine.
Uncomment the following line.
bind-address = 127.0.0.1
restart mysql
sudo restart mysql
On you local machine run the following command
ssh -i e-keypair -f remoteuser@remote.com -N -L 4444:localhost:3306
If you are not using ssh key you will be prompt for remote user assword
Edit database.php
var $default = array(
'driver' => 'mysqli',
'persistent' => false,
'host' => '127.0.0.1',
'port'=>4444,
'login' => 'user',
'password' => 'pass',
'database' => 'schema',
'prefix' => '',
);