简体   繁体   中英

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

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

For pulling data of a single table using mysqldump command, you can use following command -

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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