It is very important to regularly backup your important MySQL databases. We have found a script that will allow you to easily backup your MySQL databases.
wget http://worldcommunity.com/opensource/utilities/mysql_backup.txt
mv mysql_backup.txt mysql_backup.cgi chmod 755 mysql_backup.cgi
$email_backup = 'yes'; $admin_email_to = "you\@yourdomain.com"; $admin_email_from = "webmaster\@yourdomain.com";
@selected_databases = qw[cpanelid_dbname1 cpnaleid_dbname2];
$process_all_databases = 'no';
$password_location = 'this_file';
$user = 'mysqldb_id'; $password = 'mysqldb_password';
$mysql_backup_dir = '/home/cpanelid/mysql_backups';
mkdir mysql_backups
./mysql_backup.cgi
/home/cpanelid/mysql_backup.cgi
———
if it helps anyone, it’s really a lot easier than all this:
ssh user@domain.com “mysqldump—user=user—password=password example_database” > /Users/user/backups/my_website_db.sql
that gets your database in one line from your own computer. just put it on cron on your computer. if you wanted to make copies on your webserver itself, just drop the ssh part and the double quotes. in either case, set the output path you want and put in your username and password and database name.
edit: some spaces appear to have been dropped by the wiki software. put spaces between each part.
——-
Can someone please write about how to restore a database using the .txt archive provided by this script? Thanks.
——-
To restore an entire db from this .txt archive… I’m doing this on a local machine and using CocoaMysql to import into my railsplayground account.cat *.txt | mysql [your_db_name] -u [username] -p
I’m no expert, but I hope this helps.
———-