Need help importing a sql file into wordpress

Discussion in 'Databases' started by jamcom, Jun 22, 2010.

  1. #1
    I am trying to import a content database file into a wordpress set up, and it seems to go into the wrong section in the phpmyadmin, which is where I am directly importing it to.

    I am importing it in the right place or should I use wordpress admin?

    I can share the file if anyone needs it to see what I am trying to import.
     
    jamcom, Jun 22, 2010 IP
  2. ZeeshanButt

    ZeeshanButt Well-Known Member

    Messages:
    307
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    110
    #2
    you need to import it into phpmyadmin. select the database in phpmyadmin before importing the file.
     
    ZeeshanButt, Jun 22, 2010 IP
  3. netload

    netload Member

    Messages:
    105
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #3
    It's works with small database only. For medium and huge databases TS should use
    mysql -p -udb_user db_name < dump.sql (if ssh access is available)
    or script mysqldumper.net
     
    netload, Jun 23, 2010 IP
  4. jamcom

    jamcom Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I have been importing into the database via phpmyadmin.

    Here is what I was trying to import (a snippet of the code from the sql file)

    CREATE TABLE `recipes` (
      `id` int(11) default NULL,
      `title` varchar(255) default NULL,
      `titlecat` varchar(255) default NULL,
      `recipe` longtext,
      `category` varchar(64) default NULL,
      `category2` varchar(255) default NULL,
      `category3` varchar(50) default NULL,
      `category4` varchar(50) default NULL,
      KEY `category` (`category`),
      KEY `category2` (`category2`)
    ) TYPE=MyISAM;
    
    INSERT INTO `recipes` VALUES ('1', 'brie kisses', 'brie kisses recipe | brie recipes | appetizer recipes', '<h1>Brie Kisses</h1><p>Makes 32.</p><p>1/2 to 2/3 pounds brie cheese (wedges are fine) <br>1 (17.3 ounce) box frozen puff pastry <br>Hot pepper jelly</p><p>Cut the brie into 1/2-inch squares (leave the rind on if you like). Place on a dinner plate and put the cheese in the freezer while you thaw the puff pastry for 30 minutes at room temperature.</p><p>Unfold the thawed pastry, press together seams and roll lightly with a rolling pin to smooth it out. Cut each sheet into fourths, then cut each fourth in half. Cut the halves in half to make 16 squares per sheet.</p><p>Lightly spray a mini-muffin pan with nonstick spray. Fit a piece of dough into each cup, pushing into the cup but leaving the edges sticking up. Place a dab of pepper jelly in each cup, then top with a piece of cheese.</p><p>Bake at 400 degrees F for 10 to 15 minutes, until golden. Serve warm. (Can be prepared ahead and refrigerated until ready to bake, or you can bake them and re-warm about 10 minutes at 350 degrees F before serving.)</p>', 'appetizers', 'brie', null, null);
    Code (markup):
    Now when i import the whole file using the import function in phpmyadmin what is happening is in the database a new table appears called recipes obviously, but what I wanted or was hoping to happen was that recipes category to go in to the wordpress categories section. What am I doing wrong, because I am not completely familiar with the mysql yet.

    Thanks in advance
     
    jamcom, Jun 23, 2010 IP
  5. netload

    netload Member

    Messages:
    105
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #5
    Try this to remove exist table recipes

    DROP TABLE IF EXISTS `recipes`;
    Code (markup):
     
    netload, Jun 23, 2010 IP
  6. jamcom

    jamcom Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    ok that did remove the category recipes, but what am I doing wrong in trying to get that sql imported into the table of the wordpress categories. Does that make sense?
     
    jamcom, Jun 23, 2010 IP
  7. jamcom

    jamcom Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ok here is some screens to see if it helps explain:

    I want the data in the sql file, part of which was in that code snippet a few posts up to go into the table in the screenshot (circled blue).

    [​IMG]

    sql_wp.jpg

    Thanks
     
    jamcom, Jun 23, 2010 IP