You are here: Home Tech Notes Linux Linux CLI: MySQL Backup & Restore
Linux CLI: MySQL Backup & Restore PDF Print E-mail
User Rating: / 1
PoorBest 
Tech Notes - Linux
Written by Rick   
Tuesday, 12 May 2009 18:00

Backing up and restoring a MySQL database is a relatively easy proposition provided you have adequate access priviledges to the database. The following commands write and read to the current directory. You'll also need sufficient access priviledges in your current directory to execute these. Note:Italic words are user variables.

 

Backup (a.k.a. Dump)

$ mysqldump -u username -p databasename > outputfile.sql

 

Restore

$ mysql -u username -p --database=databasename < outputfile.sql

 

That's it, short and sweet. Told ya it was easy!

 

Comments (0)
Write comment
Your Contact Details:
Gravatar enabled
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):S
:!::?::idea::arrow:
Security
Please input the anti-spam code that you can read in the image.