View Full Version : MySQL import Errors
12-26-2007, 07:26 PM
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.
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 fileExcel 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.
12-26-2007, 08:41 PM
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.
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.
12-26-2007, 09:19 PM
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.
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.
12-26-2007, 10:01 PM
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:
-- Dumping data for table `birthdays`
INSERT INTO `birthdays` VALUES (1, 1, 'Birthday', 'Grant', 'Holmes', '', '', 'Massillon', 'OH', '44646', 'USA', 'firstname.lastname@example.org', '1958-09-15', 'Michelle', 'Jones', '', '', 'North Hollywood', 'CA', '91602', 'United States', 'email@example.com', '1968-04-01', NULL, '2007-12-17 14:54:47');
INSERT INTO `birthdays` VALUES (2, 1, 'Birthday', 'There are no', 'Entries for Today', '', '', '--', '--', '--', '--', 'firstname.lastname@example.org', '1958-12-22', '--', '-', '', '', '--', '--', '--', '--', 'email@example.com', '1958-12-19', NULL, '2007-12-22 04:10:22');
Is this how the file should be laid out?
12-26-2007, 10:22 PM
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`
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??
12-27-2007, 03:07 PM
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:
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.
01-01-2008, 11:10 PM
Better forget phpmyadmin use your own script
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)
01-02-2008, 04:13 AM
He already figured it out...
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.