Skip to content

Easy MySql backup and restore

February 17, 2007

It’s been awhile and I thought it was good time to backup my MySql database from my web host provider. I wanted a complete backup of all the tables and data since there weren’t any before (I know, playing with fire).

For the backup, you can use a handy program called mysqldump that is included with MySql. You can run this program remotely, and it will generate all the create table and insert‚ statements required to rebuild the database. Here is the command-line:

>mysqldump -u username -p -h sqlserver.host.com databasename > output.sql

And restoring is even simpler:

>mysql -u username -p db_to_restore_to And that’s all there is to it. Nice and simple.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: