0

I have an database with tons of data in it. I also wrote a new program that will change the data in the database. Is there any way to make a copy of the database before i run my program? Or is there any other solution?

What I'm thiking is making a copy of the database, Run the program, which modified the main database. If things goes wrong, how do I use my copied database data to revert the main database?

Please provide steps and commands on linux. I'm new with the database mysql and its commands.

1
  • Offtopic. not a programming question. This is more DBA-related Commented Jul 25, 2016 at 19:07

3 Answers 3

1

You can use the mysqldump command to make a backup of your database and overwrite the backup file everytime

mysqldump -u <user> -p <db> > dump.sql
Sign up to request clarification or add additional context in comments.

Comments

0

Read the following link this will tell you how to dump your database via different ways and restore it.

http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/

Basic command to dump a single database is:
mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

Comments

0

Is there any way to make a copy of the database before i run my program?

Yes, there's. You have to use the client utility mysqldump before run you app.

It is something like

shell> mysqldump [options] > dump.sql

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.