MySQL offers many ways to save and backup your database. One of the easiest ways is to use the DUMP command. The output is a text file that contains the actual insert and create command to restore the tables and data. Keep in mind that the data source files are not saved during this process. The data source files are usually located in /var/lib/mysql/database_name, or something similar. This command runs in the shell and not in mysql. # mysqldump -uname -p database_name > database_name.sql To run the file database_name.sql back into MySQL you just reverse the command. Do not forget to take off the DUMP part of the line. # mysql -uname -p database_name < database_name.sql Note: the database must exist before you can run the command. mysql > create database name;
|