Results 1 to 5 of 5

Thread: Howto download part of a mysql DB?

  1. #1
    Join Date
    Jan 2007
    Location
    Amsterdam, Nederland
    Beans
    816
    Distro
    Ubuntu Development Release

    Question Howto download part of a mysql DB?

    Hello,

    This is maybe not the right place to ask but I though I'll just give it a try.

    I rented some (shared) hosting somewhere and now I want to give a part of my mysql db to somebody as kind of a sample. The database is quite large (400+ mb) so I want to export the DB including some data, say the first 1000 records.

    Is this possible in any way?

  2. #2
    Join Date
    Apr 2008
    Location
    Phoenix, AZ
    Beans
    1,393
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Howto download part of a mysql DB?

    How many tables are you talking about in the database? For a single table, you could export the schema, and then use "select into outfile" for a portion of the records.

  3. #3
    Join Date
    Jul 2007
    Location
    South Carolina
    Beans
    103
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Howto download part of a mysql DB?

    You should be able to export your database, but as for splitting it I'm not sure exactly, you may want to just look through the exporting options on that one.
    If I weren't so goodlooking, I'd kill myself.

  4. #4
    Join Date
    Jan 2007
    Location
    Amsterdam, Nederland
    Beans
    816
    Distro
    Ubuntu Development Release

    Re: Howto download part of a mysql DB?

    I'm talking about some 10 tables. So that is not really possible.

    How can you do this "select into outfile" for a portion of the records? Is this possible in phpmyadmin?

  5. #5
    Join Date
    Apr 2008
    Location
    Phoenix, AZ
    Beans
    1,393
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Howto download part of a mysql DB?

    I haven't used phpmyadmin in a while, but it should be doable there. I usally use the mysql query browser or the cli.

    Code:
    SELECT * INTO OUTFILE '/dir/file.txt'
      FIELDS TERMINATED BY ','
      LINES TERMINATED BY '\n'
      FROM mytable LIMIT 1000;

    That will give you a comma delimited file containing 1000 records from a table.

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
  •