I have a similar problem from this question How to dump remote database without mysqldump?

How ever when I run

 ssh -f L 3306:localhost:3306 user@remoteserver -N

I am receive the following error

bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 3306
Could not result local forwarding

You are likely already running a local MySQL server that's using port 3306.

You can just change the local port for the tunneling like so:

  ssh -f -L 33306:localhost:3306 user@remoteserver -N

but of course you must point your local tools to port 33306 then.

  • so the next line of could should be mysqldump -P 33306 -h localhost -u dbuser db ? – Yusuf Ali May 3 '13 at 17:15
  • Yes, something like that. – Sven May 3 '13 at 17:16
  • I get an error 'msqldump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect` – Yusuf Ali May 3 '13 at 18:45
  • 1
    Try mysqldump -P 33306 -h -u dbuser db to avoid a connection via a local socket. – Sven May 3 '13 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.