DeskNow Knowledge Base
 
      
Home Backup and migration How to backup the MySQL database

How to backup the MySQL database

The easiest method is to use a free utility available on www.mysql.com, called MySQL Administrator. It can perform backups and restores from a graphical interface, and also schedule backups. (Tip: in the backup options, choose 'InnoDB online backup' and enable 'Complete backup')

 

An alternative method is to do it via command line. It is detailed below.

Backup

  1. type the following command:

    mysqldump --user=desknowserver --password=password --single-transaction --skip-opt --add-drop-table --add-locks --create-options --disable-keys --extended-insert --quick --set-charset desknow > /var/backup-desknow.sql
     
  2. this will generate a sql file with all the commands to recreate the database. In this example, the file would be saved as /var/backup-desknow.sql

Restore

  1. enter the mysql console (example: mysql -u root -p but this may depend on your MySQL installation)
  2. re-create an empty desknow database
    1. create database desknow character set utf8;
    2. grant all privileges on desknow.* to desknowserver@localhost identified by 'password';
    3. grant all privileges on desknow.* to desknowserver@'%' identified by 'password';
  3. exit the mysql console ( type \q  and press <enter>)
  4. type the following commands:
    mysql --user=desknowserver --password=password desknow
    SET FOREIGN_KEY_CHECKS = 0;
    SOURCE /var/backup-desknow.sql
    SET FOREIGN_KEY_CHECKS = 1;

 

Email Article Email
Print Article Print


How helpful was this article to you?
Related Articles
article How do I make the DeskNow service start after the database server?
This article applies to Windows environments...

  May 27, 2004    Views: 63693   
article How to backup the PostgreSQL database
Linux/Unix Backup: pg_dump -U desknowserver...

  October 6, 2004    Views: 68867   
article Performance tuning for MySQL database
By default MySQL is installed with very...

  April 11, 2006    Views: 21134   



Powered by Lore :: (c)2003 Pineapple Technologies.