简体   繁体   English

当我命令它抓住一个表时,如何使mysqldump退出以拉整个数据库?

[英]How to make mysqldump quit pulling the entire db when i command it to grab a single table?

Been working all day on this one.. when i request the table it gives me the entire data base.. 在这一天上一直在工作..当我请求表时,它给了我整个数据库。

#!/bin/bash
# mysqldump --user root --password=mypw sellnjho_realpro wp_posts >  atest.sql
mysqldump sellnjho_realpro wp_posts > atest.sql
echo "All Done."

Whether i add the table wp_posts or not it pulls the entire db I included the line with pw too in case that helps but the next line gives me the sql in full w/o the use of user or pw.. 无论我是否添加表wp_posts ,它是否都会拉动整个数据库,我也将pw包含在该行中,以防万一,但是下一行使我完全不使用user或pw来使用sql。

I tried user and pass to see and it failed all together telling me that using the user/pass on the command line was dangerous.. 我尝试了user和pass来查看,但都失败了,这告诉我在命令行上使用user / pass很危险。

For pulling data of a single table using mysqldump command, you can use following command - 要使用mysqldump命令提取单个表的数据,可以使用以下命令-

mysqldump --user [username] --password [password] --host [hostname] --databases [db_name] --tables [table_name] --lock-tables > file.sql

In your case, 就你而言

mysqldump --user root --password mypw --databases sellnjho_realpro --tables wp_posts --lock-tables > wp_posts.sql 

Refer this link for more information on mysqldump 参考链接以获取有关mysqldump更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM