mysqldump data only

前端 未结 9 852
傲寒
傲寒 2020-12-02 03:55

I am looking for the syntax for dumping all data in my mysql database. I don\'t want any table information.

相关标签:
9条回答
  • 2020-12-02 04:56

    Would suggest using the following snippet. Works fine even with huge tables (otherwise you'd open dump in editor and strip unneeded stuff, right? ;)

    mysqldump --no-create-info --skip-triggers --extended-insert --lock-tables --quick DB TABLE > dump.sql
    

    At least mysql 5.x required, but who runs old stuff nowadays.. :)

    0 讨论(0)
  • 2020-12-02 04:57

    Try to dump to a delimited file.

    mysqldump -u [username] -p -t -T/path/to/directory [database] --fields-enclosed-by=\" --fields-terminated-by=,
    
    0 讨论(0)
  • 2020-12-02 04:58
     >> man -k  mysqldump [enter in the terminal]
    

    you will find the below explanation

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

    --no-data, -d

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

    # To export to file (data only)
    mysqldump -t -u [user] -p[pass] -t mydb > mydb_data.sql
    
    # To export to file (structure only)
    mysqldump -d -u [user] -p[pass] -d mydb > mydb_structure.sql
    
    0 讨论(0)
提交回复
热议问题