Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mysqldump WITHOUT dropping any tables

Tags:

sql

mysql

backup

Normally, when I backup the database, I run a command like this:

mysqldump -uuser -p -hhost -Ddatabase > C:\TEMP\db_2018-04-05.sql

Inside that file, there are DROP table statements. This is normally fine, but I've modified my localhost to have a different schema than the production database.

If I execute this file, it will blow away the important changes to the database schema on my localhost.

All I need is the INSERT statements. Is there any flag I can pass mysqldump to achieve this?

like image 322
Kellen Stuart Avatar asked Apr 05 '18 23:04

Kellen Stuart


People also ask

Does Mysqldump drop table?

mysqldump can retrieve and dump table contents row by row, or it can retrieve the entire content from a table and buffer it in memory before dumping it. Buffering in memory can be a problem if you are dumping large tables. To dump tables row by row, use the --quick option (or --opt , which enables --quick ).

Can Mysqldump lock tables?

By default, the mysqldump utility, which allows to back a MySQL database, will perform a lock on all tables until the backup is complete.

What is the difference between Mysqldump and Mysqlpump?

mysqlpump is the 4th fastest followed closer by mydumper when using gzip. mysqldump is the classic old-school style to perform dumps and is the slowest of the four tools. In a server with more CPUs, the potential parallelism increases, giving even more advantage to the tools that can benefit from multiple threads.


1 Answers

Include the command for the mysqldump ignore the structure.

mysqldump --no-create-info ...

like image 176
MathOliveira Avatar answered Oct 15 '22 13:10

MathOliveira