Low cost ecommerce web development India flash website design

How do I back up my database?


The bigger a database becomes, the more nerve wracking it can be not to have a
backup of the data it contains. What if your server crashes and everything is lost?
Thankfully, MySQL comes with two alternatives: a command line utility called
mysqldump, and a query syntax for backing up tables.
Here’s how you can export the contents of a database from the command line
with mysqldump:
mysqldump -uharryf -psecret sitepoint > sitepoint.sql
This command will log in to MySQL as user “harryf” (-uharryf) with the password
“secret” (-psecret) and output the contents of the sitepoint database to
a file called sitepoint.sql. The contents of sitepoint.sql will be a series of
queries that can be run against MySQL, perhaps using the mysql utility to perform
the reverse operation from the command line:
mysql -uharryf -psecret sitepoint < sitepoint.sql
Using the PHP function system, you can execute the above command from
within a PHP script (this requires you to be logged in and able to execute PHP
scripts from the command line). The following class puts all this together in a
handy PHP form that you can use to keep regular backups of your site.
File: Database/MySQLDump.php (in SPLIB)
/**
* MySQLDump Class<br />
* Backs up a database, creating a file for each day of the week,
* using the mysqldump utility.<br />
* Can compress backup file with gzip of bzip2<br />
* Intended for command line execution in conjunction with
* cron<br />
* Requires the user executing the script has permission to execute
* mysqldump.
* <code>

website designer freelance ASP PHP ecommerce web developer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110