Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
75 views

How To Backup and Restore (Export and Import) MySQL DatabasesTutorial

This document provides instructions on how to backup and restore MySQL databases using the mysqldump utility. It explains how to export an entire database, database structures only, or just data. It also covers dumping multiple databases or all databases at once.

Uploaded by

Galih Rg M-bills
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

How To Backup and Restore (Export and Import) MySQL DatabasesTutorial

This document provides instructions on how to backup and restore MySQL databases using the mysqldump utility. It explains how to export an entire database, database structures only, or just data. It also covers dumping multiple databases or all databases at once.

Uploaded by

Galih Rg M-bills
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

How to Backup and Restore (Export and Import) MySQL Databases T...

http://www.mydigitallife.info/how-to-backup-and-restore-export-and-...

Living Digitally and Electronically

Social Stuff:

HOW TO GUIDE

SOFTWARE

MOBILE APP

INTERNET

GADGETS

GAMING

DEVELOP

COMMUNITY

DEVELOP

SEARCH
My Digital Life Editorial Team 38 Comments

Jul 21, 2007

How to Backup and Restore (Export and Import) MySQL Databases Tutorial
phpMyAdmin can be used to export or backup MySQL databases easily. However, if the database size is very big, it probably wont be a good idea. phpMyAdmin allows users to save database dump as file or display on screen, which involves exporting SQL statements from the server, and transmitting the data across slower network connection or Internet to users computer. This process slow the exporting process, increase database locking time and thus MySQL unavailability, slow the server and may simply crash the Apache HTTPD server if too many incoming web connections hogging the systems resources. The better way to backup and export MySQL database is by doing the task locally on the server, so that the tables data can be instantly dumped on the local disk without delay. Thus export speed will be faster and reduce the time MySQL database or table is locked for accessing. This tutorial is the guide on how to backup (export) and restore (import) MySQL database(s) on the database server itself by using the mysqldump and mysql utilities. There are basically two methods to backup MySQL, one is by copying all table files (*.frm, *.MYD, and *.MYI files) or by using mysqlhotcopy utility, but it only works for MyISAM tables. Below tutorial will concentrate on mysqldump which works for both MyISAM and InnoDB tables. How to Export or Backup or Dump A MySQL Database

My Digital Life
Like

15,644 people like My Digital Life.

Facebook social plugin

Follow @MDLinfo

1,865 followers

Get latest updates in email for To export a MySQL database into a dump file, simply type the following command syntax in the shell. You can use Telnet or SSH to remotely login to the machine if you dont have access to the physical box. mysqldump -u username -ppassword database_name > dump.sql Replace username with a valid MySQL user ID, password with the valid password for the user (IMPORTANT: no space after -p and the password, else mysqldump will prompt you for password yet will treat the password as database name, so the backup will fail) and database_name with the actual name of the database you want to export. Finally, you can put whatever name you like for the output SQL dump file, here been dump.sql. The while data, tables, structures and database of database_name will be backed up into a SQL text file named dump.sql with the above command. How to Export A MySQL Database Structures Only If you no longer need the data inside the databases tables (unlikely), simply add no-data switch to export only the tables structures. For example, the syntax is: mysqldump -u username -ppassword no-data database_name > dump.sql How to Backup Only Data of a MySQL Database If you only want the data to be backed up, use no-create-info option. With this setting, the dump will not re-create the database, tables, fields, and other structures when importing. Use this only if you pretty sure that you have a duplicate databases with same structure, where you only need to refresh the data. mysqldump -u username -ppassword no-create-info database_name > dump.sql How to Dump Several MySQL Databases into Text File databases option allows you to specify more than 1 database. Example syntax: mysqldump -u username -ppassword databases db_name1 [db_name2 ...] > dump.sql How to Dump All Databases in MySQL Server To dump all databases, use the all-databases option, and no databases name need to be specified anymore. mysqldump -u username -ppassword all-databases > dump.sql free:

RECENT ARTICLES
Free $5 Amazon Appstore Credit for Android Apps and Games Left 4 Dead 2 Free Download on Steam 3D Builder App for Windows 8.1 3D Printing Free Download IE11 for Windows 7 Direct Download Links (32-bit and 64-bit) Official Facebook App for Windows 8 Free Download

MORE ON TIP AND TRICK


Oppo N1 Cameraphone That For Selfies AMDs Radeon R7 250X Targets Budget-Minded PC Gamers With Costs $99 Pentax K-50 With 81 Weather-Sealed Body and 120 Colour Combinations Innergie PocketCell Duo Power On the Go Protect Your Samsung Galaxy S4 With OTTER Case

1 of 4

27/02/2014 16:33

How to Backup and Restore (Export and Import) MySQL Databases T...

http://www.mydigitallife.info/how-to-backup-and-restore-export-and-...

How to Online Backup InnoDB Tables Backup the database inevitable cause MySQL server unavailable to applications because when exporting, all tables acquired a global read lock using FLUSH TABLES WITH READ LOCK at the 2005 - 2014 My Digital Life. All Rights Reserved. beginning of the dump until finish. So although READ statements can proceed, all INSERT, UPDATE and DELETE statements will have to queue due to locked tables, as if MySQL is down or stalled. If youre using InnoDB, single-transaction is the way to minimize this locking time duration to almost non-existent as if performing an online backup. It works by reading the binary log coordinates as soon as the lock has been acquired, and lock is then immediately released.

About Us | Contact Us | Legal (DMCA) | Privacy Policy | Sitemap

2 of 4

27/02/2014 16:33

How to Backup and Restore (Export and Import) MySQL Databases T...

http://www.mydigitallife.info/how-to-backup-and-restore-export-and-...

3 of 4

27/02/2014 16:33

How to Backup and Restore (Export and Import) MySQL Databases T...

http://www.mydigitallife.info/how-to-backup-and-restore-export-and-...

4 of 4

27/02/2014 16:33

You might also like