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 Gebruikers die dit nuttig vonden
Was dit antwoord nuttig?

Related Articles

redirect using .htaccess

1) Temporary Redirect : Redirect temp / http://www.test.com This will redirect...

Enable the full text indexing for a MSSQL database

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

Reset the SQL Server ‘sa’ user password?

Open Enterprise Manager and expand the registered SQL server. Expand Security. Click on...

Manage Database Roles

Solution Database roles are conceptually completely separate from operating system users....

Connect to my MSSQL database via Enterprise Manager?

To connect to your MSSQL database using Enterprise Manager, please perform the following: 1....