Tuesday, 5 May 2020

how to mysqldump remote db from local machine

https://stackoverflow.com/questions/2989724/how-to-mysqldump-remote-db-from-local-machine


As I haven't seen it at serverfault yet, and the answer is quite simple:
Change:
ssh -f -L3310:remote.server:3306 user@remote.server -N
To:
ssh -f -L3310:localhost:3306 user@remote.server -N
And change:
mysqldump -P 3310 -h localhost -u mysql_user -p database_name table_name
To:
mysqldump -P 3310 -h 127.0.0.1 -u mysql_user -p database_name table_name
(do not use localhost, it's one of these 'special meaning' nonsense that probably connects by socket rather then by port)
edit: well, to elaborate: if host is set to localhost, a configured (or default) --socket option is assumed. See the manual for which option files are sought / used. Under Windows, this can be a named pipe.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive