Results 1 to 5 of 5
  1. #1
    Full Member
    Join Date
    January 18th, 2005
    Posts
    435
    OK, here I am, making my first clumsy attempts with MySQL and PHP.

    I'm using phpmyadminin, and I tried to enter data into a table using the query:

    LOAD DATA INFILE "data.txt" INTO TABLE tablename

    So after it uploads the file, I get the error message:

    Error

    SQL-query :

    LOAD DATA INFILE "data.txt" INTO TABLE tablename

    MySQL said:


    Access denied for user: 'user@localhost' (Using password: YES)

    Why Am I getting this errot message? Do I need to CHMOD anything, or what?

    What am I doing wrong?

    Any help will be much appreciated.

  2. #2
    Full Member ellen-s4y's Avatar
    Join Date
    January 18th, 2005
    Posts
    489
    Try copy and pasting the data into the query box rather than uploading the text file. I had the same problem and it was the only way I could get it to work.

  3. #3
    ABW Ambassador Joey's Avatar
    Join Date
    January 18th, 2005
    Posts
    549
    Hi Netsu,

    I had the same problem in this post:
    http://abw.infopop.cc/6/ubb.x?a=tpc&...1&m=8316044704

    The problem is that many hosts disable SQl's 'LOAD DATA INFILE' features for security reasons. Probably the easiest way to to upload a datafeed under these conditions is to use find and replace on the datafeed in order to turn it into a .sql file. Then just load the .sql file with PHPMyAdmin.

    Here's an example 2 line datafeed:

    PRODUCTNAME|SKEW|PRICE
    PRODUCTNAME2|SKEW2|PRICE2

    First escape all your current apostrophes by replacing ' with \'

    Next find and replace your seperator (the PIPE in this case) with this: ', ' so now you should have this:

    PRODUCTNAME', 'SKEW', 'PRICE
    PRODUCTNAME2', 'SKEW2', 'PRICE2

    Find and replace your line breaks (\n) with this:

    '); \n INSERT INTO your_table_name VALUES ('

    In the end your datafeed should be converted into a bunch of sql queries like this:

    INSERT INTO your_table_name VALUES ('PRODUCTNAME', 'SKEW', 'PRICE');
    INSERT INTO TABLE your_table_name VALUES ('PRODUCTNAME2', 'SKEW2', 'PRICE2');

    Finally, add INSERT INTO TABLE your_table_name VALUES (' to the very beginning of the file and '); to the very end.

    Simply save your feed as a .sql file and use PHPMyAdmin to find and run the file. It's a lot more work than just doing a LOAD DATA INFILE query, but it gets the job done pretty fast, especially if you automate the find and replace queries.

  4. #4
    Moderator MichaelColey's Avatar
    Join Date
    January 18th, 2005
    Location
    Mansfield, TX
    Posts
    16,232
    If you use Joey's method, you'll need to accomodate for any ' in the data, too. Also, if you're planning on updating your data regularly, you'll need to do things a little differently. The REPLACE command works well, as it does either an INSERT or UPDATE, as needed.

    Michael Coley
    Amazing-Bargains.com

  5. #5
    Full Member
    Join Date
    January 18th, 2005
    Posts
    435
    Thank you guys so much for your replies and help!

    I won't be able to try your suggestions until tommorrow, but I wanted to tell you how much I appreciate your input, and the time you took to help a newbie

    Thanks!

  6. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Access Denied
    By Snib in forum Rakuten LinkShare - LS
    Replies: 7
    Last Post: November 3rd, 2005, 08:22 PM
  2. MYSQL LOAD DATA - access denied
    By vivekar in forum Programming / Datafeeds / Tools
    Replies: 6
    Last Post: October 4th, 2004, 04:58 PM
  3. Access denied loging into CJ
    By SeventiesMartin in forum Commission Junction - CJ
    Replies: 5
    Last Post: July 13th, 2004, 06:37 AM

Posting Permissions

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