title: restoring mysql database from dump file unknown database error
body: <p>I'm having trouble restoring from a dump file. The dump file has an option to build the database if it doesn't exist. So why does the script below only works when I have the database.</p>
  
  <p>mysql -u root -p1234 modal_db &lt; c:\wamp\db_backups\modal_db\mdb.sql</p>
  
  <p>Here's the dump file</p>
  
  <pre><code>-- MySQL dump 10.13  Distrib 5.5.8, for Win32 (x86)
  --
  -- Host: localhost    Database: modal_db
  -- ------------------------------------------------------
  -- Server version   5.5.8-log
  
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  /*!40101 SET NAMES utf8 */;
  /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  /*!40103 SET TIME_ZONE='+00:00' */;
  /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  
  --
  -- Current Database: `modal_db`
  --
  
  CREATE DATABASE /*!32312 IF NOT EXISTS*/ `modal_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
  
  USE `modal_db`;
  
  --
  -- Table structure for table `user_info`
  --
  
  DROP TABLE IF EXISTS `user_info`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `user_info` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(30) NOT NULL,
    `email` varchar(30) NOT NULL,
    `password` varchar(30) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Dumping data for table `user_info`
  --
  
  LOCK TABLES `user_info` WRITE;
  /*!40000 ALTER TABLE `user_info` DISABLE KEYS */;
  INSERT INTO `user_info` VALUES (1,'[object Object]','[object Object]','[object Object]'),(2,'amaya','etongancheta@yahoo.com','neato'),(3,'yoh','yoh@yahoo.com','ff2cbe54328162379ba1baf57b23f9'),(4,'fure','fure@gmail.com','263bce650e68ab4e23f28263760b9f'),(5,'koroja','koroja@yahoo.com','665b3a3829375f4acbb00858299a08'),(6,'maro','ala@yahoo.com','2f66aed2714edaa599e148990c9d16'),(7,'deg','deg@ymail.com','n'),(8,'mario','super_mario@gmail.com','c1210473c214e0cf5968bf147ed079'),(9,'mizuo','hewajim@y.com','n'),(10,'bakuryu','bakuryu@b.com','b'),(11,'maron','m@yahoo.com','m'),(12,'gatou','g@y.com','g'),(13,'mocha','mo@y.com','mo'),(14,'pizza','pizza@gm.com','gm'),(15,'bbq','bbq@food.com','food'),(16,'salad','salad@s.com','s');
  /*!40000 ALTER TABLE `user_info` ENABLE KEYS */;
  UNLOCK TABLES;
  /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  
  /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  
  -- Dump completed on 2011-06-12 21:53:48
  </code></pre>
  
  <p>Please help. How do I restore the database if it has been dropped?</p>