Feb 092008
 

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

Warning: fopen(/home/dynasty/linuxdynasty.org/wp-content/plugins/wp-google-plus-one/lib/standard.txt) [function.fopen]: failed to open stream: No such file or directory in /home/dynasty/linuxdynasty.org/wp-content/plugins/wp-google-plus-one/plusone.php on line 104

Warning: fread(): supplied argument is not a valid stream resource in /home/dynasty/linuxdynasty.org/wp-content/plugins/wp-google-plus-one/plusone.php on line 105

Warning: fclose(): supplied argument is not a valid stream resource in /home/dynasty/linuxdynasty.org/wp-content/plugins/wp-google-plus-one/plusone.php on line 106
.