SolveITProblems is a project of intellectual club

SolveITProblems это проект интеллектуального клуба

вторник, 22 января 2013 г.

Duplicating a MySQL database

Hi guys.

Today I would like to open you another mystery about MySQL databases.

Everyone faced with a problem of duplicating data from one database to another. We can use export tools of DB managers or something else, but often a huge amount of data gives us troubles. So the simpliest method is to use the next command:

mysqldump -u rootlogin --password=rootpassword source_dbname | mysql -u rootlogin --password=rootpassword -h localhost dest_dbname &

If you want first to save the db in a dump file you must write:

mysqldump -u rootlogin --password=rootpassword source_dbname > somefilename.sql &

And then you can import the dump correspondingly:

mysql -u rootlogin --password=rootpassword -h localhost dest_dbname < somefilename.sql &

That's all folks!

Комментариев нет:

Отправка комментария