我正在寻找在我的mysql数据库转储所有数据的语法。我不需要任何表信息。
当前回答
mysqldump --no-create-info ...
你还可以用:
——跳过触发器:如果你正在使用触发器 ——no-create-db:如果你正在使用——databases…选项 ——compact:如果你想去掉额外的注释
其他回答
如果你只想要INSERT查询,使用下面的方法:
Mysqldump—skip-triggers—compact—no-create-info
mysqldump --no-create-info ...
你还可以用:
——跳过触发器:如果你正在使用触发器 ——no-create-db:如果你正在使用——databases…选项 ——compact:如果你想去掉额外的注释
这应该可以工作:
# To export to file (data only)
mysqldump -u [user] -p[pass] --no-create-info mydb > mydb.sql
# To export to file (structure only)
mysqldump -u [user] -p[pass] --no-data mydb > mydb.sql
# To import to database
mysql -u [user] -p[pass] mydb < mydb.sql
注意:在-p和[pass]之间没有空格
尝试转储到一个带分隔符的文件。
mysqldump -u [username] -p -t -T/path/to/directory [database] --fields-enclosed-by=\" --fields-terminated-by=,
>> man -k mysqldump [enter in the terminal]
下面的解释如下
--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