Jump to content

Importing Text File Into Mysql


Recommended Posts

I'm trying to import a txt file, into one of my DBs but I keep getting a "file not found" error.

 

Sorry if this is a repeat question but I've read all the post I can find on this and I can't seem to get the sql to work.

>LOAD DATA LOCAL INFILE '/home/www.mysite.com/public_html/One.txt'
INTO TABLE OneOrMore
FIELDS TERMINATED BY '\t' 
LINES TERMINATED BY '\n' 
(Gram, doc1, doc2, doc3, doc4, doc5);

I know it has something to do with my infile location but I don't know what it is...in other posts I've seen it as /home/cpanelName/public_html/file.txt

 

but what is my cpanelName, is it just my user name? If so that doesn't seem to be working any more than putting domain name url as I show above.

 

Thanks in advance.

mike.

Link to comment
Share on other sites

The cpanelname is the name given to you by TCH to log in to your cpanel and ftp. The name are in your welcome email.

Thanks, that's what I thought but my sql is not working from within phpmyadmin.

 

Below is the full query I'm trying to run. I've set up the table with the 427 columns(yes, that many columns) and the text file is in my public_html folder. I'm going to need to do this for other data as well so if possible I'd like to get it working so I can do it on my own...

 

>LOAD DATA LOCAL INFILE '/home/*****/public_html/One.txt' 
INTO TABLE OneOrMore 
FIELDS TERMINATED BY '\t' 
LINES TERMINATED BY '\n'(
Gram, doc1, doc2, doc3, doc4, doc5, doc6, doc7, doc8, doc9, doc10, doc11, doc12, doc13, doc14, doc15, doc16, doc17, doc18, doc19, doc20, doc21, doc22, doc23, doc24, doc25, doc26, doc27, doc28, doc29, doc30, doc31, doc32, doc33, doc34, doc35, doc36, doc37, doc38, doc39, doc40, doc41, doc42, doc43, doc44, doc45, doc46, doc47, doc48, doc49, doc50, doc51, doc52, doc53, doc54, doc55, doc56, doc57, doc58, doc59, doc60, doc61, doc62, doc63, doc64, doc65, doc66, doc67, doc68, doc69, doc70, doc71, doc72, doc73, doc74, doc75, doc76, doc77, doc78, doc79, doc80, doc81, doc82, doc83, doc84, doc85, doc86, doc87, doc88, doc89, doc90, doc91, doc92, doc93, doc94, doc95, doc96, doc97, doc98, doc99, doc100, doc101, doc102, doc103, doc104, doc105, doc106, doc107, doc108, doc109, doc110, doc111, doc112, doc113, doc114, doc115, doc116, doc117, doc118, doc119, doc120, doc121, doc122, doc123, doc124, doc125, doc126, doc127, doc128, doc129, doc130, doc131, doc132, doc133, doc134, doc135, doc136, doc137, doc138, doc139, doc140, doc141, doc142, doc143, doc144, doc145, doc146, doc147, doc148, doc149, doc150, doc151, doc152, doc153, doc154, doc155, doc156, doc157, doc158, doc159, doc160, doc161, doc162, doc163, doc164, doc165, doc166, doc167, doc168, doc169, doc170, doc171, doc172, doc173, doc174, doc175, doc176, doc177, doc178, doc179, doc180, doc181, doc182, doc183, doc184, doc185, doc186, doc187, doc188, doc189, doc190, doc191, doc192, doc193, doc194, doc195, doc196, doc197, doc198, doc199, doc200, doc201, doc202, doc203, doc204, doc205, doc206, doc207, doc208, doc209, doc210, doc211, doc212, doc213, doc214, doc215, doc216, doc217, doc218, doc219, doc220, doc221, doc222, doc223, doc224, doc225, doc226, doc227, doc228, doc229, doc230, doc231, doc232, doc233, doc234, doc235, doc236, doc237, doc238, doc239, doc240, doc241, doc242, doc243, doc244, doc245, doc246, doc247, doc248, doc249, doc250, doc251, doc252, doc253, doc254, doc255, doc256, doc257, doc258, doc259, doc260, doc261, doc262, doc263, doc264, doc265, doc266, doc267, doc268, doc269, doc270, doc271, doc272, doc273, doc274, doc275, doc276, doc277, doc278, doc279, doc280, doc281, doc282, doc283, doc284, doc285, doc286, doc287, doc288, doc289, doc290, doc291, doc292, doc293, doc294, doc295, doc296, doc297, doc298, doc299, doc300, doc301, doc302, doc303, doc304, doc305, doc306, doc307, doc308, doc309, doc310, doc311, doc312, doc313, doc314, doc315, doc316, doc317, doc318, doc319, doc320, doc321, doc322, doc323, doc324, doc325, doc326, doc327, doc328, doc329, doc330, doc331, doc332, doc333, doc334, doc335, doc336, doc337, doc338, doc339, doc340, doc341, doc342, doc343, doc344, doc345, doc346, doc347, doc348, doc349, doc350, doc351, doc352, doc353, doc354, doc355, doc356, doc357, doc358, doc359, doc360, doc361, doc362, doc363, doc364, doc365, doc366, doc367, doc368, doc369, doc370, doc371, doc372, doc373, doc374, doc375, doc376, doc377, doc378, doc379, doc380, doc381, doc382, doc383, doc384, doc385, doc386, doc387, doc388, doc389, doc390, doc391, doc392, doc393, doc394, doc395, doc396, doc397, doc398, doc399, doc400, doc401, doc402, doc403, doc404, doc405, doc406, doc407, doc408, doc409, doc410, doc411, doc412, doc413, doc414, doc415, doc416, doc417, doc418, doc419, doc420, doc421, doc422, doc423, doc424, doc425, dstar
)

 

Thanks for your help

Mike

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...