faqts : Computers : Databases : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

19 of 25 people (76%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Database: MySql: Backup: How to backup your MySql databases on Microsoft Windows? [mysqldump.exe]

May 2nd, 2008 21:52
dman, Knud van Eeden, http://sturly.com


----------------------------------------------------------------------
--- Knud van Eeden --- 06 April 2005 - 08:06 pm ----------------------

Database: MySql: Backup: How to backup your MySql databases on 
Microsoft Windows? [mysqldump.exe]

---
---

Method: run the program mysqldump.exe

---

Run the program

 mysqldump.exe

(located in your MySql 'bin' directory)

---

Steps: Overview:

 1. -Goto your MySql 'bin' directory

 2. -On the MSDOS command line type the command

      mysqldump.exe --all-database ><your filename>

      ---

      e.g. to backup all databases, use the following:

       mysqldump.exe --all-database >c:\temp\ddd.txt

      ---

      e.g. to backup 1 database, use the following:

       mysqldump.exe yourdatabasename >yourfilename

       e.g.

       mysqldump.exe database1 >c:\temp\ddd.txt

 3. -That will store the SQL commands necessary to
     recreate this databses

      e.g. the content of this file ddd.txt
           would be similar to:

--- cut here: begin --------------------------------------------------

--
-- Current Database: `databasemytest1`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `databasemytest1` /*!40100 
DEFAULT CHARACTER SET latin1 */;

USE `databasemytest1`;

--
-- Table structure for table `tablename`
--

DROP TABLE IF EXISTS `tablename`;
CREATE TABLE `tablename` (
  `columnNumber` int(11) NOT NULL auto_increment,
  `columnName` varchar(50) default NULL,
  PRIMARY KEY  (`columnNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tablename`
--


/*!40000 ALTER TABLE `tablename` DISABLE KEYS */;
LOCK TABLES `tablename` WRITE;
INSERT INTO `tablename` VALUES (1,'John'),(2,'Vanessa'),(3,'Bella');
UNLOCK TABLES;
/*!40000 ALTER TABLE `tablename` ENABLE KEYS */;

--
-- Table structure for table `tablestudy`
--

DROP TABLE IF EXISTS `tablestudy`;
CREATE TABLE `tablestudy` (
  `columnStudy` varchar(50) default NULL,
  `columnNumber` int(11) NOT NULL default '0',
  KEY `columnNumber` (`columnNumber`),
  CONSTRAINT `tablestudy_ibfk_1` FOREIGN KEY (`columnNumber`) 
REFERENCES `tablename` (`columnNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tablestudy`
--


/*!40000 ALTER TABLE `tablestudy` DISABLE KEYS */;
LOCK TABLES `tablestudy` WRITE;
INSERT INTO `tablestudy` VALUES ('Physics',1),('Mathematics',2),
('Computer science',3);
UNLOCK TABLES;
/*!40000 ALTER TABLE `tablestudy` ENABLE KEYS */;

--- cut here: end ----------------------------------------------------


 4. Type the command

     mysqldump.exe --help |more

    to get help information

---
---

Method: Backup using PHPMyAdmin

 1. -Select your database

     1. -Choose the 'export' button in
         PHPMyAdmin

         1. e.g. copy/paste the resulting text
            containing the SQL queries.

---
---

Internet: see also:

---

Database: Relational: MySql: Link: Overview: Can you give an overview 
of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/35331/fid/52

----------------------------------------------------------------------