SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Transferring lots of tables (but not entire DB) from one server to another?

    I have a database with a few hundred tables, about half of which I want to copy to another server, and the other half I don't. I don't know if there's a good way to do this in mysqldump.

    Is there any way to list the tables to be copied in a text file, and have mysqldump read the table list from the text file and transfer those tables?

    Or is there any way other, perhaps without mysqldump, to accomplish this?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

    mysqldump will accept a list of tables to dump

    mysqldump dbname table1 table2 table3 table4 ...

    If you had the tables listed in a file, you could write a shell script to construct the above command

  3. #3
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

    mysqldump will accept a list of tables to dump

    mysqldump dbname table1 table2 table3 table4 ...

    If you had the tables listed in a file, you could write a shell script to construct the above command
    Thanks. I know it will accept a list of tables like that, but would it accept hundreds (perhaps thousands actually) of tables in that fashion?

    In a shell script, if there were many mysqldump commands each transferring a single table or a few tables, would the script wait for one mysqldump to finish before starting the next one?

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kadence View Post
    would the script wait for one mysqldump to finish before starting the next one?
    Yes, unless you don't want it to. In which case you could make each task run in the background and they'd all start at the same time.

    You might want to batch the dumps X tables at a time.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •