title: How to interpret mysqldump output?
body: <p>My intent is to extract the triggers, functions, and stored procedures from a database, edit them, and add them to another database.</p>
  
  <p>Below is a partial output from <code>mysqldump</code>.  I understand how the database is updated with the <code>DROP</code>, <code>CREATE</code>, and<code>INSERT INTO</code> statements, but don't understand the triggers.  I expected the following:</p>
  
  <pre><code>CREATE TRIGGER users_BINS BEFORE INSERT ON users
  FOR EACH ROW
  if(IFNULL(NEW.idPublic, 0) = 0) THEN
     INSERT INTO _inc_accounts (type, accountsId, idPublic) values ("users",NEW.accountsId,1)
     ON DUPLICATE KEY UPDATE idPublic = idPublic + 1;
     SET NEW.idPublic=(SELECT idPublic FROM _inc_accounts WHERE accountsId=NEW.accountsId AND type="users");
  END IF;
  </code></pre>
  
  <p>What does <code>/*!50003</code> mean?  I thought it was some comment which would mean the <code>CREATE</code> for the trigger isn't present, but I must be misinterpreting the output. 
   How should one interpret a mysqldump output?</p>
  
  <p><code>mysqldump -u username-ppassword --routines mydb</code></p>
  
  <pre><code>--
  -- Table structure for table `users`
  --
  
  DROP TABLE IF EXISTS `users`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `users` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `idPublic` int(11) NOT NULL,
    `accountsId` int(11) NOT NULL,
    `firstname` varchar(45) NOT NULL,
    `lastname` varchar(45) NOT NULL,
    `email` varchar(45) NOT NULL,
    `username` varchar(45) NOT NULL,
    `password` char(255) NOT NULL COMMENT 'Password currently uses bcrypt and only requires 60 characters, but may change over time.',
    `tsCreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
    `osTicketId` int(11) NOT NULL,
    `phone` varchar(45) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `uniqueEmail` (`accountsId`,`email`),
    UNIQUE KEY `uniqueUsername` (`accountsId`,`username`),
    KEY `fk_users_accounts1_idx` (`accountsId`),
    CONSTRAINT `fk_users_accounts1` FOREIGN KEY (`accountsId`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
  ) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Dumping data for table `users`
  --
  
  LOCK TABLES `users` WRITE;
  /*!40000 ALTER TABLE `users` DISABLE KEYS */;
  INSERT INTO `users` VALUES (xxx
  /*!40000 ALTER TABLE `users` ENABLE KEYS */;
  UNLOCK TABLES;
  /*!50003 SET @saved_cs_client      = @@character_set_client */ ;
  /*!50003 SET @saved_cs_results     = @@character_set_results */ ;
  /*!50003 SET @saved_col_connection = @@collation_connection */ ;
  /*!50003 SET character_set_client  = utf8 */ ;
  /*!50003 SET character_set_results = utf8 */ ;
  /*!50003 SET collation_connection  = utf8_general_ci */ ;
  /*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
  /*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
  DELIMITER ;;
  /*!50003 CREATE*/ /*!50017 DEFINER=`michael`@`12.34.56.78`*/ /*!50003 TRIGGER `users_BINS` BEFORE INSERT ON `users` FOR EACH ROW
  BEGIN
  if(IFNULL(NEW.idPublic, 0) = 0) THEN
     INSERT INTO _inc_accounts (type, accountsId, idPublic) values ("users",NEW.accountsId,1)
     ON DUPLICATE KEY UPDATE idPublic = idPublic + 1;
     SET NEW.idPublic=(SELECT idPublic FROM _inc_accounts WHERE accountsId=NEW.accountsId AND type="users");
  END IF;
  END */;;
  DELIMITER ;
  /*!50003 SET sql_mode              = @saved_sql_mode */ ;
  /*!50003 SET character_set_client  = @saved_cs_client */ ;
  /*!50003 SET character_set_results = @saved_cs_results */ ;
  /*!50003 SET collation_connection  = @saved_col_connection */ ;
  </code></pre>