I'm try to use mysqldump
to export only the DB schema -- no data, no additional SQL comments, just the CREATE TABLE
commands. Here's what I've got so far:
mysqldump -h localhost -u root -p --no-data --compact some_db
It almost achieves what I want, but I'd like to eliminate the "character set" lines (those like the first 3 lines in the example output below). Is there a mysqldump
option to do that?
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `foo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bar_id` int(11) DEFAULT NULL,
`bazz` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=369348 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bar` (
...etc.
Here's my version info, in case that matters:
mysqldump Ver 10.13 Distrib 5.1.34, for Win32 (ia32)
mysql Ver 14.14 Distrib 5.1.34, for Win32 (ia32)