Karl Krelove wrote:

I'm trying to import a large amount of data from an Access database containing information about 9,000+ students in a school system. I've created a table 'student_list' to hold the data and issued the following command:

LOAD DATA INFILE 'home/karl/Student_List.csv' into table student_list FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';

In response I get: ERROR 13 (HY000): Can't get stat of '/var/lib/mysql/home/karl/Student_List.csv' (Errcode: 2)

I've looked up the error on the MySQL website and found the error listed as Error 1013 in the listing of server errors for MySQL 4.1, but I can't find an explanation.

1st question - the obvious one - does anyone know what is triggering the error?

2nd question - why does MySQL only list the errors? I could already read what it said in the CLI client. Is there a place on the web site that actually explains what specific errors mean?

Thanks in advance for any input.

Karl Krelove

Hi Karl,

Do you have your home directories under the mysql path? When you are doing a LOAD DATA INFILE the following rules (from the manual) apply to the pathname

When locating files on the server host, the server uses the following rules:

   *

     If an absolute pathname is given, the server uses the pathname as is.

   *

     If a relative pathname with one or more leading components is
     given, the server searches for the file relative to the server's
     data directory.

   *

     If a filename with no leading components is given, the server
     looks for the file in the database directory of the default database.

Note that these rules mean that a file named as |./myfile.txt| is read from the server's data directory, whereas the same file named as |myfile.txt| is read from the database directory of the default database. For example, the following |LOAD DATA| statement reads the file |data.txt| from the database directory for |db1| because |db1| is the current database, even though the statement explicitly loads the file into a table in the |db2| database:

mysql> *|USE db1;|*
mysql> *|LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;|*

Note that Windows pathnames are specified using forward slashes rather than backslashes. If you do use backslashes, you must double them.

For security reasons, when reading text files located on the server, the files must either reside in the database directory or be readable by all. Also, to use |LOAD DATA INFILE| on server files, you must have the |FILE| privilege.

I suspect, based on these rules, it will be looking for the file relative to /var/lib/mysql as it states in the error message. Further info is available at http://dev.mysql.com/doc/refman/5.0/en/load-data.html

Regards

--

David Logan
South Australia

when in trouble, or in doubt
run in circles, scream and shout


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to