Backing up and restoring a MySQL database from the command line

. Shell into your box as root, then:
mysqldump -a -u USERNAME -p DATABASE > FILENAME.mysql

You will be prompted for your database password and then the DATABASE will be dumped to a plain-text file called FILENAME.mysql.
The resulting file, FILENAME.mysql, is a full backup with which you can fully restore your database in case of problems.

Restoring via the command line
1. Drop the database
mysqladmin -u USERNAME -p drop DATABASE

2. Recreate the database
mysqladmin -u USERNAME -p create DATABASE

3. Import the backup data
mysql -u USERNAME -p DATABASE < FILENAME.mysql

  • Email, SSL
  • 0 Пользователи нашли это полезным
Помог ли вам данный ответ?

Related Articles

Copy MySQL database to another server through shell?

Copying MySQL Databases to another server If you are using MySQL 3.23 or later, you can copy the...

ColdFusion DSN parameters are not updated

SYMPTOMS New CF DSN records are created.  Even the set of parameters is tried to be updated...

Fix nameservers not working for Linux servers

If you have your own namerservers or you are using nameservers provided by host, and these...

Manage Query Cache

You can check whether the query cache is present in your MySQL server using the following...

Enable the full text indexing for a MSSQL database

Syntax sp_fulltext_database Initializes full-text indexing or removes all full-text catalogs...