restoring a single table from mysqldump

Following Restore one table from an ALL database dump and Restore a Single Table From mysqldump, I would like to add my own thoughts and comments on the subject.I also wish to note performance issues with the two suggested solutions, and offer improvements.

via On restoring a single table from mysqldump | code.openark.org.


face@mac:V:150 $ sed -n “/^– Table structure for table `mx_categories`/,/^– Table structure for table/p” wordpress_2009-12-02_02h15m.Wednesday.sql
— Table structure for table `mx_categories`

DROP TABLE IF EXISTS `mx_categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mx_categories` (
`cat_ID` int(4) NOT NULL AUTO_INCREMENT,
`cat_name` varchar(55) NOT NULL DEFAULT ”,
`category_nicename` varchar(200) NOT NULL DEFAULT ”,
`category_description` text NOT NULL,
`category_parent` int(4) NOT NULL DEFAULT ‘0’,
PRIMARY KEY (`cat_ID`),
UNIQUE KEY `cat_name` (`cat_name`),
KEY `category_nicename` (`category_nicename`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;


— Dumping data for table `mx_categories`

LOCK TABLES `mx_categories` WRITE;
/*!40000 ALTER TABLE `mx_categories` DISABLE KEYS */;
INSERT INTO `mx_categories` VALUES (1,’General’,’general’,”,0),(2,’Unix Notes’,’unix-notes’,”,0),(3,’AppleScript Notes’,’applescript-notes’,”,0),(4,’Misc Notes’,’misc-notes’,”,0),(5,’System Software Notes’,’system-software-notes’,”,0),(6,’Applications Notes’,’applications-notes’,”,0),(7,’Web Serving’,’web-serving’,”,0),(8,’Utilities Notes’,’utilities-notes’,”,0);
/*!40000 ALTER TABLE `mx_categories` ENABLE KEYS */;
UNLOCK TABLES;


— Table structure for table `mx_commentmeta`