Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqldump extracting data without table structure

I'm trying to dump all of my mysql data for one database into a single file. That said, I don't want to include the table structures in this file (there is another file which will have the structure of the tables in it).

Is it possible to strictly extract the data and not the table structures?

What I am doing right now ...

# Extracts the database structure mysqldump -d -hlocalhost -uusername -ppassword database -r database.sql  # Extracts each table and their data individually mysqldump -d -hlocalhost -uusername -ppassword database --tab . 

The first command will spit out a .sql file with the structure of all entities in the database whereas the second one automatically makes the .sql and .txt files with the structure and entities split out.

What I need is one copy of the entire database which is done the same way.

Thanks

like image 462
judda Avatar asked Aug 25 '12 14:08

judda


People also ask

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.

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 ).

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.

Which MySQL command shows the structure of a table?

To show the schema, we can use the DESC command. This gives the description about the table structure.


1 Answers

Use the --no-create-info option, or its shorthand -t:

  • --no-create-info, -t

    Do not write CREATE TABLE statements that re-create each dumped table.

    Note

    This option does not not exclude statements creating log file groups or tablespaces from mysqldump output; however, you can use the --no-tablespaces option for this purpose.

like image 178
eggyal Avatar answered Sep 21 '22 13:09

eggyal