MySQL – How to Force mysqldump to Include All Data in MariaDB

mariadbmariadb-5.5MySQLmysqldump

for years I've been using mysqldump without much trouble. Recently I joined a project that is using "MySQL dump 10.14 Distrib 5.5.52-MariaDB, for Linux (x86_64)" and when I attempt to do a dump it includes all of the create table statements, and the routines if I include –routines, but it doesn't contain any of the data. There are no INSERT statements in the file at all.

I've tried on multiple databases within this DBMS instance, and I've tried using several different user accounts, including root. I've checked that the users I'm using have access to the data, and if I log directly into mysql from those usernames I can browse the data.

I've been unable to find any help information on the web because all posts seem to assume that the insert data will just be there (which I think it right). Has anyone seen something like this before or is there a suggestion of what I might try to get a real database backup?

I recognize this is a very old MariaDB version, I'm new to the team and I'm willing to update it, but not until after I know the data is successfully backed up somewhere.

Thanks in advance for your help, this is really confusing me.

Here's what I'm trying:

/usr/bin/mysqldump -u root -p --all-databases  > dbbackup-dump-$(date +\%Y-\%m-\%d).sql

/usr/bin/mysqldump -u root -p -d databasename  > dbbackup-dump-$(date +\%Y-\%m-\%d).sql

Best Answer

Answer is very simple. -d stands for NO DATA !!!

Here is the MariaDB Documentation:

Do not write any table row information (that is, do not dump table contents). This is useful if you want to dump only the CREATE TABLE statement for the table (for example, to create an empty copy of the table by loading the dump file).

Just get rid of the -d and you are good to go.

UPDATE 2019-09-24 11:04 EDT

Let me clarify why you are seeing what you see,

  • When you used --databases, the line USE databasename; was added before all INSERT INTO statements for each named database. (Please review MySQL Docs on --databases)
  • When you used --all-databases, the line USE databasename; was added before all INSERT INTOs for each given database in the MySQL instance (Please review MySQL Docs on --all-databases)
  • When you used -d, you were telling mysqldump not to dump the data, whether you name a database or not. Even if you use --database or all-databases, no data will come out. (Please view MySQL Docs on --no-data)