Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: MySQL import Errors

  1. #1
    Join Date
    Dec 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default MySQL import Errors

    I have researched this high and low. There seem to be 1000 answers out there that unfortunately DON'T help me. My client is on a Yahoo server. They allow NO external access to the DB/table, so you must import from within PHPmyAdmin.

    When I go to the DB and the Table I wish to import to, I must be able to browse to the file on my PC and upload it. No matter what I've tried from using Excel to create the file to using note pad... From using quotes to not using them, colons, commas, etc. No matter what I do, I get errors.

    Surely there must be a simple way to do this. I even abandoned trying to import my bigger table just to import/upload a simple two field file with three records. ERROR. Usually a syntax.

    Any help?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    When I go to the DB and the Table I wish to import to, I must be able to browse to the file on my PC and upload it.
    phpMyAdmin does have a create table feature, you know.
    No matter what I've tried from using Excel to create the file
    Excel can export to MySQL? I'd've thought it would only work with MSSQL, if that.
    to using note pad... From using quotes to not using them, colons, commas, etc. No matter what I do, I get errors.
    Then you're doing something wrong.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Dec 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    phpMyAdmin does have a create table feature, you know.
    Yes, I know. I need to be able to ADD any data to my table, not start from scratch.

    Excel can export to MySQL? I'd've thought it would only work with MSSQL, if that.
    I was only using excel as another alternative. As I know it will create a CSV or TXT file for import. Just trying that in case Excel knew something I didn't about creating the file.

    Then you're doing something wrong.
    Thus the reason for my post.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes, I know. I need to be able to ADD any data to my table, not start from scratch.
    It can do that directly too.
    As I know it will create a CSV or TXT file for import.
    Not an SQL file, however, which is what phpMyAdmin expects.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Dec 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Twey, thank you for your attempts to help me, but telling me it's expecting SQL doesn't help me any more than telling me I'm doing it wrong. I know that, and that's why I'm asking for help. If PHPmyAdmin wants and SQL file, why does it say I can upload a TEXT file for instance.

    More helpful would be telling me how to assemble the file as SQL or pointing me to a source.

    Thanks!

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Twey, thank you for your attempts to help me, but telling me it's expecting SQL doesn't help me any more than telling me I'm doing it wrong. I know that, and that's why I'm asking for help.
    But you didn't give me any hints as to what you might be doing wrong, such as posting the non-working file, or explaining what you actually want to accomplish with this file. I'm still not sure why you want to create a file then import it rather than just using phpMyAdmin's insert form, for example. The only thing I can do is point out what you should be doing in vague terms. If you don't want a vague answer, don't ask a vague question.
    If PHPmyAdmin wants and SQL file, why does it say I can upload a TEXT file for instance.

    More helpful would be telling me how to assemble the file as SQL or pointing me to a source.
    It wants an SQL file -- a plain text file containing a series of SQL queries.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Dec 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    As a newbie, it's hard to tell people exactly what is wrong as we often don't know. I go and study 5 forums and two tutorials, do what they tell me to and SQL says, "syntax" error. Why? I DON"T KNOW!!! Thus my explanation of what all I'd tried and failed at. That should give you an idea that I'm stuck. Newbies with mistakes can't tell you what they are doing wrong. If I knew, I'd fix it.

    SQL... are you speaking of the same type file I'd get from an SQL export? I got a file with an SQL extension and the data looks like this:

    Code:
    -- Dumping data for table `birthdays`
    -- 
    
    INSERT INTO `birthdays` VALUES (1, 1, 'Birthday', 'Grant', 'Holmes', '', '', 'Massillon', 'OH', '44646', 'USA', 'grant@grantholmes.com', '1958-09-15', 'Michelle', 'Jones', '', '', 'North Hollywood', 'CA', '91602', 'United States', 'michelle@domain.com', '1968-04-01', NULL, '2007-12-17 14:54:47');
    INSERT INTO `birthdays` VALUES (2, 1, 'Birthday', 'There are no', 'Entries for Today', '', '', '--', '--', '--', '--', 'grant@grantholmes.com', '1958-12-22', '--', '-', '', '', '--', '--', '--', '--', 'michelle@domain.com', '1958-12-19', NULL, '2007-12-22 04:10:22');
    Is this how the file should be laid out?

  8. #8
    Join Date
    Dec 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So, I used this format to test my small test table. I made a text file like this:
    INSERT INTO `test` VALUES ('Value1', 'Value2');

    And named the file "test.sql"

    I got back:
    ""INSERT INTO `test`
    VALUES (
    'Value1', 'Value2'
    )

    Error: #1046 - No database selected
    ==

    How then do I select the database? In PHPmyAdmin, I was already inside the DB inside the table when I did the import??

  9. #9
    Join Date
    Dec 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well, I figured it out. Here's the instructions for those as lost as I was (am).

    First create the import text file of data to import. Make sure to have the field layout matching. Separate values with ";". So in my simple two field values test the data looked like this:
    Code:
    data1;data2
    I saved my file with the extension of (sql) or "filename.sql" locally on my PC.

    When in PHPmyAdmin, on the left, select your database (DB). then select the table you wish to import to. In the upper left corner you'll see an SQL button under the PHPMyAdmin logo and click on that button.

    It will open a separate smaller window. At the bottom of that window, you'll see a text link that says, "Insert data from a text file into the table"- Click that link. Back at the main page, PHPmyAdmin will open a screen where you can browse to upload your data, including changing many parameters. I changed nothing. I hit submit and the data was amended to my table correctly.

    It shouldn't be that hard.

  10. #10
    Join Date
    Jan 2008
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Grant!

    Better forget phpmyadmin use your own script

    method:
    loop and add data (asp,php) from one database to another exit the loop when it (loop counter)reaches to 5000. then again change your loop from 5000 to 10000 and run the script again


    hope this will help you as i added my 60000 members from ms access to mysql (i got same problem)

    thanks

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
  •