I'm running the following command in mysql to dump a database:
mysqldump --login-path=bc --single-transaction --routines my_database > /tmp/my_database
The dump file that is generated only contains variables, and no table structures and data.
- MySQL dump 10.13 Distrib 5.6.49-89.0, for Linux (x86_64)
--
-- Host: my_host Database: my_database
-- ------------------------------------------------------
-- Server version 5.7.35-38-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 */;
--
-- Dumping routines for database 'my_database'
--
/*!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 2021-09-23 12:28:51
~
My co-worker runs the same command on the same host, but his dump file is drastically different. It includes the same SET variables as my file, but also:
--
-- Table structure for table `table_1`
--
DROP TABLE IF EXISTS `table_1`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `table_1` (
`autoinc` int(10) unsigned NOT NULL AUTO_INCREMENT,
`field1` varchar(30) NOT NULL,
`field2` varchar(40) NOT NULL,
... primary key stuff
... unique key stuff
... constraints
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `table_1`
--
LOCK TABLES `table_1` WRITE;
/*!40000 ALTER TABLE `table_1` DISABLE KEYS */;
/*!40000 ALTER TABLE `table_1` ENABLE KEYS */;
UNLOCK TABLES;
... etc
I was reading up on the my.cnf file, which I do have in /etc/, but nothing in that file differs from my co-workers. I'm very confused as to how we have such different dump files - running the same commands, on the same host, with the same my.cnf file.
Any direction on what to do / try next is appreciated. This is as far as I've gotten. Could it be something other than the my.cnf file? Permissions based?
I don't want to try a new command, because that would require a re-write of a bunch of unit tests in Perl that integrate with mysql. My goal is to figure out what is causing my dump file specifically to leave out the structures and data.