Backup MySQL data using mysqldump

Backup complete database:

mysqldump -u <username> -p<password> <dbname> > dbname.sql

Backup only specific tables:

mysqldump -u <username> -p<password> <dbname> <tablename> \ > tablename.sql

Restore a .sql file:

mysql -u <username> -p<password> <dbname> < file.sql

Note: There can’t be any empty spaces between -p and the password parameter.

Examples:

mysqldump -u root -p123456 itdb > itdb_280912.sql
mysqldump -u root -p123456 itdb itdb_posts \ > itdb_posts_280912.sql
mysql -u root -p123456 itdb < itdb_backup.sql

Setup automated database backup with mysqldump and cron jobs for Linux

Start cron manager by running command $ crontab -e and type the following line at the bottom:

0 4 * * * sudo mysqldump -u root -p<password> <dbname> | gzip > /mnt/nas/<dbname>_bak_`data ' %Y-%m-%d'`.sql.gz

This will create a job entry in cron which starts every night at 0400 AM. What it does is running mysqldump to backup the specified <dbname> and also compresses it to a gzip file and saves it to /mnt/nas/ (replace with wherever you want to store the file).

Open Computer Management as administrator in W7

Method #1 – Executable binary file

  • Open Windows Explorer and navigate to:
    C:\Windows\System32
  • Hold the [Shift] button and right-click on compmgmt.msc and press Run as administrator or Run as other userif you wish to use another user.

 

Method #2 – Command prompt

  • Open the Command Prompt and enter:
    runas /user:domain\username "mmc compmgmt.msc"
    Note: You must include mmc to inform the runas command that this is a Microsoft Management Console snap-in instead of an ordinary Win32 application

 

Method #3 – Context options menu

  • Simply right-click on Computer or This PC from the Startmenu or Windows Explorer and click on Manage. In most circumstances this will trigger the UAC prompt
    Computer context menu

 

In addition to compmgmt.msc, here are some other useful Windows snap-ins:

  • compmgmt.msc – Computer management
  • lusrmgr.msc – Local users and groups
  • perfmon.msc – Resource monitor
  • devmgmt.msc – Device manager
  • printmanagement.msc – Print management
  • taskschd.msc – Task scheduler
  • services.msc – Services

Find more snap-ins by going to %windir%\system32 and searching for *.msc files.