Activities

September 2010
M T W T F S S
« Aug   Oct »
 12345
6789101112
13141516171819
20212223242526
27282930  

Backing up a mysql table, auto-restore a database

This command  will help you backup a specified table using mysql command.. This would be useful if you have a large database  and have few tables only frequently modified.
How to dump particular tables
#mysqldump database_name tables_name -r outout.sql -uusername -h192.168.10.15 -ppass

sometimes  you may required to restore the database frequently from the back up using script which is automated. I found source command will not be worked while we  using mysql ” -e ” parameter

eg : mysql -uuser -hhost -ppassword  -e “use slocal; call import_twom_data1(0,12000);”

So the best way to use  following command during the automated script execution time to restore the database.

$mysql database name  -uusername -ppass <mysqldump.sql

$mysql slocal  -udbslocal -ppass < csv_import.sql

-Njoy

3 comments to Backing up a mysql table, auto-restore a database

  • Gopi

    $mysql database name -uusername -ppass <mysqldump.sql

    $mysql slocal -udbslocal -ppass mysql database1 -u root -p root < mysqldump.sql;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql database1 -u root -p root < mysqldump.sql' at line 1,

    please let you guide me in current dump command , i musing the Mysql 5.1.149 version, refering manual i tried several times but no luck, please guide in setting automated backup using cron job for backup scrips..

    Thanks in Advance..

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>