Backing up your database

You should probably change directory to some place other than XAMPP's home (!), by putting a command like this in the shell:

cd c:\Users\<your user name here>\Desktop

This* is the command you'll need to back up that database. 

mysqldump -u root -B --add-drop-database databaseName > databaseFile.sql

On Unix systems, capitalization matters, so I try to be consistent in case my web site is ever put onto Unix.  Be sure that "databaseName" has the same case as you used inside MySQL.  I added the "quotes" here because Unix required them -- DOS did not.

How do I restore?

mysql -u root < databaseFile.sql

Moving databases between computers

To do this, back up on the old computer and restore on the other (below).


*mysqldump -u root -B --add-drop-database databaseName > databaseFile.sql:

-B --add-drop-database means "add code to create the database if it doesn't already exist, and delete it and recreate it if it doesn't."  Or more succinctly:  "Don't argue with me about whether the database is already there; handle it!"