Bowlero

From Tech stuff to paranormal to internet marketing



Backup and Restore MySQL Database Using Command Line

Method 1 (Long Method)

mysqldump -u USER -pPASSWORD DATABASE > filename.sql

copy the file to the new host and restore using

mysql -u USER -pPASSWORD DATABASE < filename.sql

Method 2 (short method)

mysqldump –opt –compress –user=USERHERE –password=PWHERE
–host=SOURCE.HOST.HERE SOURCE_DB_NAME | mysql –user=USERHERE
–password=PWHERE –host=TARGET.HOST.HERE -D TARGET_DB_NAME -C
TARGET_DB_NAME







2 Responses to 'Backup and Restore MySQL Database Using Command Line'

  1. Tuxero - January 30th, 2008 at 5:01 am

    Great man!
    I will begin to use mysql shortly. I’ll need these commands.
    Thanks!

  2. obstinate - April 17th, 2008 at 4:50 pm

    hi i dont know much about linux but my boss gave me a job to backup all the mysql database and tables from fedora core4 running as web/database server. i can enter in fedora using remote desktop from my laptop but after that i am unable to do anything. if any one can help me in finding mysql and then tell me how to backup it at different directory of server as well as on my laptop. its urgent or i will loose my job. thanks in advance


Leave a Reply