How can I backup a mysql database which is running on a remote server, I need to store the back up file in the local pc.
Join Stack Overflow to learn, share knowledge, and build your career.
|
Try it with Mysqldump
|
||||
|
|
|
Have you got access to SSH? You can use this command in shell to backup an entire database:
This is actually one command followed by the Note: The lack of a space between -p and the mysql password is not a typo. However, if you leave the |
|||||||||
|
|
No one mentions anything about the --single-transaction option. People should use it by default for InnoDB tables to ensure data consistency. In this case:
This makes sure the dump is run in a single transaction that's isolated from the others, preventing backup of a partial transaction. For instance, consider you have a game server where people can purchase gears with their account credits. There are essentially 2 operations against the database:
Now if the dump happens in between these operations, the next time you restore the backup would result in the user losing the purchased item, because the second operation isn't dumped in the SQL dump file. While it's just an option, there are basically not much of a reason why you don't use this option with mysqldump. |
|||||||||
|
|
This topic shows up on the first page of my google result, so here's a little useful tip for new comers. You could also dump the sql and gzip it in one line:
|
|||
|
|
|
|||||||||
|
|
you can choose an other way :
And choose your sql file like :
|
|||||
|
protected by Quentin Sep 25 '15 at 14:45
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?