twilitegxa Posted August 18, 2008 Share Posted August 18, 2008 How do I need to set up the records in the text file in order to import the records into my MySQL database? I am using MySQL 5.0.51b and I currently have a text file saved with each field separated by a comma and this was able to be imported by Microsoft Access in this format, but is not accepted by MySQL. What format do I need to put my records in for the text file to be imported into the MySQL database? I am running a program call WampServer, if that helps. Quote Link to comment Share on other sites More sharing options...
elflacodepr Posted August 18, 2008 Share Posted August 18, 2008 after you finish editing select "save as" and write it like records.sql or what ever you want, it must have the .sql extension at the end. To open the file simply use notepad Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted August 18, 2008 Author Share Posted August 18, 2008 I tried changing the extention, but I still recived an error about the syntax. I have each field like: "field1","field2","field3"....and so on. Is this right? Maybe the character set is wrong for some reason? When I import, it is set to utf8. I tried saving it with the same character set, but it's still not working. This is the error I receive: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"Sailor Moon","Serena Tsukino","Purity And The Soul","13","06","30","1978","4","' at line 1 Quote Link to comment Share on other sites More sharing options...
elflacodepr Posted August 19, 2008 Share Posted August 19, 2008 can you post the entire query you are using please? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 19, 2008 Share Posted August 19, 2008 Start by checking if your favorite/available database management tool has a CSV import option. If not, then take a look at the LOAD DATA LOCAL INFILE query statement - http://dev.mysql.com/doc/refman/5.0/en/load-data.html Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted August 19, 2008 Author Share Posted August 19, 2008 I'm not using a query. It's kind of a built-in feature of the program I'm using. It has an import option. The program is WampServer. I didn't know I could use a query to do it. Can anyone help e out with how to do the query? It might be easier that way possibly. I am still very new to MySQL and PHP. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.