I'm trying to pull the database schema from a remote server, but
mysqldump is too slow to output (125+) tables' structures.
- If I enter the said server and run
mysqldump --compact --compress --no-data --add-drop-database --databases --user=myuser --password=123 mydb > dump.sqlit's almost instant.
- If I run the same thing over ssh it takes 2.5 secs (
ssh myserver mysqldump [...] > dump.sql)
- However, if I use the
--hostso I can use the database credentials only, instead of the SSH credentials, it takes 2min40s to run!
What makes mysqldump so slow when running over its own protocol? It dumps each table (all at once) every few seconds, then waits, dumps the next one...
Is there anything I could do to make things faster?
EDIT: I wrote about that db adventure, to show the final solutions.