Posts tagged: Copy Mysql Databases to another machine

Copy Mysql Databases to another machine

By , November 12, 2009 10:56 PM

How to Backup MySql Databases to another machine.

Method 1 – Dump and reload

You can use mysqldump to create a simple backup of your database using the following syntax

a) Read Lock??????
b) Then dump all the databases by:

Single Databases
Dump only one database – Structure and Data
mysqldump -u [Username] -p [password] [databasename] > backupfile.sql

Dump only one database – Structure Only
mysqldump -u [Username] -p [password] –no-data [databasename] > structurebackup.sq   (remember to remove the []’s)

Multiple Databases
Dump only Select databases – Structure and Data
mysqldump -u [Username] -p [password] – -databases [databasename1] [databasename2] [databasename3] > multibackup.sql

Back up all the databases in the server- Structure and Data
mysqldump -u [Username] -p [password] – -all-databases> alldatabases.sql

Back up all the databases in the server- Structure Only
mysqldump -u [Username] -p [password] – -no-data –databases [databasename1] [databasename2] [databasename3]> allstructurebackup.sql

Ended up using

mysqldump – – all-databases > fulldb.dump

AND NOW only this shit works

mysqldump –all-databases -u root -p –all-databases>sqldumpp.sql

How to Restore your Mysql Database

Single Databases
mysql -u [Username] -p [password] [databasename] < databasefile.sql

Multiple Databases

Thomas Challenger Thomas Challenger