No Account Yet?

You are not logged in.

Add to: JBookmarks Add to: Facebook Add to: Windows Live Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Blogmarks Add to: Technorati Add to: Newsvine Add to: Google Information
How to Back up a MySQL database E-mail
Database HowTo's - MySQL HowTo's
Written by Allen Sanabria   
Saturday, 09 February 2008 13:29

If you've got a website with a database or a custom database running for your applications, it is imperative that you make regular backups of the database...


Following examples are using mysqldump

    • You can use mysqldump to create a simple backup of your database. Here is an example..mysqldump -u username --password=password databasename > backup.sql
    • username - this is your database username
    • password - this is the password for your database
    • databasename - the name of your database
    • backupfile.sql - the file to which the backup should be written.

    • To backup multiple databases, you will have to do the following example.
    • mysqldump -u test1 --password=pass1 --databases world universe >world_and_universe.sql

    • Now what if we want to back up all of our databases. To do that follow the next example.
    • mysqldump -u test1 --password=pass1 --all-databases >alldb.sql

    • Here we are going to show you another way of backing up a databases and certain tables using the --add-drop-table. This essentially adds a drop table statement before every create statement. The purpose of this is so that it will remove any previous copies of the table before recreating it.
    • This example will add a drop statement before every create statement.
      mysqldump --add-drop-table -u test1 --password=pass1 world > world.sql
    • This statement will add a drop statement before the following tables only.
      mysqldump --add-drop-table -u test1 --password=pass1 Customers world_users world_passwd> world.sql
Comments
Search RSS
Only registered users can write comments!

3.22 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Wednesday, 14 May 2008 11:50 )