.txt databse to MySQL
I have a databse in .txt format (I think it's called CVS) that my CGI script accesses, but now I have PHP and MySQL support so I would like to switch from CGI to PHP and MySQL. My databse has over 800 entries so I would rather not input each one so I am hopeing that someone knows an easy way to convert my .txt file MySQL databse.
Before I go any further.. One of the feilds in my databse contains alot more than 255 characters (more around 1000, but it varies between entry) and from my very small tiny bit of PHP and MySQL knowlege I don't know if I can have a feild over 255 characters.
Back to converting... It is delimited (seperated by) a "|" and has seven "feilds" for each entry. Any help is appreciated very much.
Your in luck. Mysql can host huge sizes. Using Blobs or Large Text. You'll want to learn how to setup your tables so that you get each field right. That's the hard part. Go to mysql.com and read up on that. Then, once you have your table done, you can use LOAD INFILE from the command line and load the text file into the mysql table of your choice.
Or, you can cheat and use phpmyadmin from phpWizard.net . I use that quite a bit.
Hope that helps.
Use the Large Text type as blob is for binary data.
And be aware phpMyAdmin can't handle large files when importing data.
I had a 5mg file from a forum i ran and when i tried to import it phpmyadmin puked it up at me.
had to cut and paste small pieces of the file in one at a time.
I think I'll try cheating with PHPmyadmin. Thank for the quick reply...
I have tried uploading a simple csv into MySQL using MyPHPAdmin but it is not working for me. Here are the details, this is the last hurdle in my project so I would be very grateful for any help.
|name |email |
| Mathew | firstname.lastname@example.org |
| Mark | email@example.com |
| Luke | firstname.lastname@example.org |
| John | email@example.com |
CSV file is:
Now when I try to add a textile in the above format I get the following error:
I know that the "php6kAJXj" is the temporary name given to my file, why can it not find the file?
LOAD DATA LOCAL INFILE '/tmp/php6kAJXj' INTO TABLE `leads` FIELDS TERMINATED BY ';' ENCLOSED BY '"'
File '/tmp/phpiaYxvs' not found (Errcode: 0)