SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Montana, USA
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Trouble importing .csv , .txt file

    I have been unable to use phpMyAdmin 2.5.7 for importing a .csv or .txt files. Excel does not have a problem with them. I have also tried the command line MySQL statements.

    How are others doing this? It is pretty basic and should be painless.

    Mike

  2. #2
    Non-Member
    Join Date
    Aug 2002
    Location
    USA
    Posts
    544
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try doing it from the command line (mysql ...). If that doesn't work, there's probably some data that needs to be escaped.

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Montana, USA
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It has 13,000 lines. If MySQL cannot do this I need to find another database.

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Montana, USA
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Success...almost!
    I have been able to import the text file using:

    ./mysqlimport -u username -ppassword -L --fields-terminated-by ',' database fullpath/filename.txt

    I just have one more problem, how to strip the '"' enclosing the fields.

    yahoo!
    Mike

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Montana, USA
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mleary2001
    Success...almost!
    I have been able to import the text file using:

    ./mysqlimport -u username -ppassword -L --fields-terminated-by ',' database fullpath/filename.txt

    I just have one more problem, how to strip the '"' enclosing the fields.

    yahoo!
    Mike
    i just added the option "--fields-enclosed-by '"' " and I was able to strip the quotes!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •