Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQLdump no data export

I want to do a mysqldump with the table definition and table data every day, for this I config a cron job with this comand: "mysqldump -u user -pxxxxx site_DB | gzip > backup/site/site_t_$(date | awk {'print $1""$2""$3"_"$4'}).sql.gz" but this only export the table definition. What is the correct command to export the data? Thanks

like image 252
maderic_m Avatar asked Dec 21 '22 14:12

maderic_m


2 Answers

By default mysqldump exports data too - you have to use the --no-data flag to make it only export structure. Since yours IS doing it by default, that means "no-data" is set in your a MySQL options file, which you can find following these directions.

like image 84
David Fells Avatar answered Dec 28 '22 07:12

David Fells


I was having the same issue. re-run the dump command with '--databases' as follows:

mysqldump -u user -pxxxxx --databases site_DB . . . . 
like image 41
ZacSaeed Avatar answered Dec 28 '22 07:12

ZacSaeed