Using Percona Toolkit on a remote MySQL server via SSH tunnel

The easiest way to install Percona Toolkit on MacOS is via brew:

brew install percona-toolkit

Create an SSH Tunnel to the MySQL database server, assigning it to local port 3307 (this could however be any unused port):

ssh -fNg -L 3307: <user>@<dbserver>

Test the MySQL connection via the newly created SSH tunnel:

mysql -h -P 3307 -u<user> -p

In order to remove the SSH Tunnel, find the process running with port 3307 (or which ever port you used during the tunnel creation):

ps aux | grep ssh

Now attempt to kill the process:

kill <id>

If this doesn’t work, and only as a last resort, use the -9 flag:

kill -9 <id>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s