How-To Geek
Backup MySQL Database to a file
Backing up your database is a very important system administration task, and should generally be run from a cron job at scheduled intervals. We will use the mysqldump utility included with mysql to dump the contents of the database to a text file that can be easily re-imported.
Syntax:
mysqldump -h localhost -u root -pmypassword databasename > dumpfile.sql
Example:
mysqldump -h localhost -u root -p2Uad7as9 database01 > dumpfile.sql
This will give you a text file containing all the commands required to recreate the database.
|
Subscribe |
Daily Email Updates |
|
You can get our how-to articles in your inbox each day for free. Just enter your email below: |
- By The Geek on 09/11/06
Comments (3)
Comments are closed on this post.
If you'd like to continue the discussion on this topic, you can do so at our forum.
Go to the Forum

Very useful. Thanks
Good timing. I’m doing development on an ASP.NET website in both Windows and multiple Linux machines (via Mono) and I need to easily dump an updated backup file into the same shared folder (all via Dropbox) so whatever system I am developing on I can update the database.
Hi there was just wondering, do you use mysql commandline or could you use command prompt to execute the syntax
I tried command prompt and it said access denied, LOCK TABLES?
Could you help?
thanx