-
Website
http://www.tech-recipes.com/ -
Original page
http://www.tech-recipes.com/rx/2345/import_csv_file_directly_into_mysql/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
davak
83 comments · 1 points
-
Web Design
3 comments · 1 points
-
danishbacker
9 comments · 1 points
-
flexinfo
11 comments · 1 points
-
Tonychelle
4 comments · 1 points
-
-
Popular Threads
-
Facebook: How To Get Only Status Updates on Your FB Home Page
1 week ago · 4 comments
-
Firefox: Enable Case Sensitive Searches When Using Find (Ctrl+F)
5 days ago · 1 comment
-
Firefox 3.6: Enable Visual Previews When Using Ctrl+Tab (Windows Only)
6 days ago · 1 comment
-
Windows 7: How To Disable Live Preview for Taskbar Thumbnails
2 weeks ago · 2 comments
-
Gmail: How to block a sender from your inbox
3 weeks ago · 3 comments
-
Facebook: How To Get Only Status Updates on Your FB Home Page
Copied the csv file into /var/lib/mysql/mydb at my ubuntu box.
*mydb is the name of my database
(idnum,username,md5(password))
how about if i used md5 in my password??
and i want my password field converted into md5.
email me pls. ir_bs756@yahoo.com
please send full code of importing file into mysql database. at my email (ashish@tiainterweb.com)
thanks
If the passwords in your CSV file are not already MD5() then just import them as per the instructions above then run this query:
UPDATE `users` SET `password` = MD5(`password`);
@ashish:
That is the "full code". There is no more. The only step you have to do before this is to create a table that matches the CSV file you already have. No one can tell you how to do that without having your CSV file. Don't forget to modify the query above to match the table you have just created.
@zlid:
No it can't. Fields are given names and types at the same time when the table is created. To assign the names automatically, MySQL would have to also assign the column types automatically which would mean scanning down through the entire CSV file to make sure that there were no letters in a column that started with numbers and finding the longest string in a column that started with a string and so on. There are too many options in table creation to allow it to be left up to software. NULL or NOT NULL ? DATE, DATETIME, TIME, CHAR, VARCHAR or TEXT ? What if you have a column full of numbers but one Excel error message that looks like "#value" ?
You will have to create the table yourself before importing the CSV file.