I was just wondering what methods admins here use to backup their website? I normally used phpmyadmin, but for larger databases it does not help as much. What methods do you use to copy your database, and save it to your server and/or PC machine at home/office?
I use a combination of cron and shell script. I use rsync for shipping backups to another standby server.
cPanel backup works fine for saving or backing up but if your moving a big database the only way to go is SQLYOG. Its awesome, and free.
If you code the scripts yourself I would prefer that you duplicate your original table. The copy will be the same and it will take data inputs same time as the original. then make such code eg. <? $orderdata = "INSERT INTO orderdata(package ) VALUES ('".$_POST['package']."') $orderdata_backup = "INSERT INTO orderdata_backup (package) VALUES ('".$_POST['package']."') ?> the second table is a duplicate of the first but takes in data at the time as the first one.
If you don't have cron in your host, use some online cron jobs such as www.setcronjob.com (free 3 cron daily in 1 year), onlinecronjobs.com, cronjobs.org, etc. And, mysqldump doesn't require you to have ssh access
MYSQL Database Backup: Use mysqldump to create a simple backup of your database using the following syntax. mysqldump -u [username] -p [password] [databasename] > [backupfile.sql] o [username] - this is your database username o [password] - this is the password for your database o [databasename] - the name of your database o [backupfile.sql] - the file to which the backup should be written.
You can use the mysqldump command to take the backups of your database. mysql:>mysqldump -help will give you the options for using the command.
Use the terminal.. Log in to your server via SSH mysqldump -u YOUR_DB_USER -p YOUR_DB_NAME > YOUR_SQL_TO_BE_MADE_X-XX-2009.sql It'll prompt you for your password. Type it in. It'll generate an SQL file of your complete database. THEN... tar -cvf YOUR_SQL_FILE_GENERATED_X-XX-2009.sql gzip YOUR_SQL_FILE_GENERATED_X-XX-2009.tar Now you have a compressed file named YOUR_SQL_FILE_GENERATED_X-XX-2009.tar.gz Now log into your new (or other) server via SSH. And... ftp ftp.YOUR_OLD_SERVER_ADDRESS dir DIRECTORY_NAME get YOUR_SQL_FILE_GENERATED_X-XX-2009.tar.gz quit That'll transfer the backup file no matter how large it is... Then from the new servers terminal: tar -xzvf YOUR_SQL_FILE_GENERATED_X-XX-2009.tar.gz It'll decompress and extract YOUR_SQL_FILE_GENERATED_X-XX-2009.sql Then you type (assuming you created the mysql database and a user): mysql -u YOUR_DB_USER -p YOUR_DB_NAME < YOUR_SQL_FILE_GENERATED_X-XX-2009.sql And your server will automatically import the backup. Basically I gave you directions on how to transfer a database easily. The process can take a few minutes up to hours depending on how big yoru db is.