Sample Header Ad - 728x90

mysqldump takes forever to dump tables from a remote server

2 votes
1 answer
2684 views
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.sql it'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 --host so 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](https://medium.com/@igorsantos07/a-not-so-small-rant-on-mysql-based-techniques-to-copy-database-structures-4333f8ff8384#.8qiega4cq) , to show the final solutions.
Asked by igorsantos07 (133 rep)
Feb 21, 2017, 04:51 PM
Last activity: Dec 6, 2018, 03:52 PM