Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: MySQL return a "file not found error" when the file exists

  1. #1
    Join Date
    Dec 2006
    Location
    São Paulo, Brazil
    Beans
    30
    Distro
    Ubuntu 10.10 Maverick Meerkat

    MySQL return a "file not found error" when the file exists

    Hi,

    I'm having a problem with mysql.

    When I try to load a file in a table like this:

    Code:
    LOAD DATA INFILE "/home/calsaverini/data.txt" INTO TABLE CMIG4;
    It returns the error:
    Code:
     ERROR 29 (HY000): File '/home/calsaverini/data.txt' not found (Errcode: 13)
    But the file IS THERE!

    Anyone have any clue what the problem could be?

  2. #2
    Join Date
    May 2008
    Location
    Eugene, OR, USA
    Beans
    435

    Re: MySQL return a "file not found error" when the file exists

    Permissions problem perhaps? The file is going to be read in with the privs of the mysqld process, not your privs. Try this:

    Code:
    chmod o+rx /home/calsaverini
    chmod o+r /home/calsaverini/data.txt
    Then try to load your file as before.
    Hal Pomeranz, Deer Run Associates
    [[ Various Linux/Unix related documents ]]
    [[ Command-Line Kung Fu blog ]]

  3. #3
    Join Date
    Dec 2006
    Location
    São Paulo, Brazil
    Beans
    30
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: MySQL return a "file not found error" when the file exists

    Permissions are not the problem.

    I've granted all permissions to the file and the same error still occurs.

  4. #4
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,288
    Distro
    Kubuntu

    Re: MySQL return a "file not found error" when the file exists

    HalPomeranz recommended that you change the permissions on your user directory (that is /home/calsaverini). Did you change it?

    The other thing you could try to do is place the file in /tmp to see if that makes a difference.

  5. #5
    Join Date
    Jan 2007
    Beans
    97
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: MySQL return a "file not found error" when the file exists

    There is a workaround.

    https://bugs.launchpad.net/ubuntu/+s....0/+bug/244406

    I am trying to get this classified as a bug.

    HTH;
    John

  6. #6
    Join Date
    Sep 2010
    Beans
    12

    Re: MySQL return a "file not found error" when the file exists

    I found that using LOAD DATA LOCAL INFILE worked for me. Without the LOCAL keyword it failed with the same error described above.

    According to the MySQL doc, LOCAL causes the client to read the file and send it to the server. This seems to eliminate the question of whether the server can read the file.

  7. #7
    Join Date
    Feb 2009
    Beans
    53

    Re: MySQL return a "file not found error" when the file exists

    Hey joculi, thanks!! I had exactly calverini's problem and your solution worked.

  8. #8
    Join Date
    Feb 2011
    Beans
    2

    Re: MySQL return a "file not found error" when the file exists

    That's the same thing for me.
    However using LOCAL isn't a solution, it's just a bypass.

    The problem can be resolved by configuring AppArmor, see this thread : http://stackoverflow.com/questions/2...t-into-outfile, or directly :

    Code:
    sudo vi /etc/apparmor.d/usr.sbin.mysqld
    /usr/sbin/mysqld {
    ...
    /var/log/mysql/ r,
    /var/log/mysql/* rw,
    /var/run/mysqld/mysqld.pid w,
    /var/run/mysqld/mysqld.sock w,
    /data/ r,
    /data/* rw,

    }

    Code:
    # sudo /etc/init.d/apparmor reload

  9. #9
    Join Date
    Jan 2008
    Beans
    2

    Re: MySQL return a "file not found error" when the file exists

    I had a similar case, file was /tmp/test.infile, clearly existed /tmp has 777 permissions, file had 755 permissions. I did

    sudo chown mysql:mysql /tmp/test.infile

    And suddenly mysqld could see it.

    (adding LOCAL didn't work in my case)

  10. #10
    Join Date
    Feb 2013
    Beans
    1

    Re: MySQL return a "file not found error" when the file exists

    LaurentEdel - you are the man. Thank you to you. I can import from where ever now.

    Toda raba

Page 1 of 2 12 LastLast

Tags for this Thread

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
  •