mysql - Errcode: 13 when loading data into SQL Database -


attempting load file db.

create temporary table if not exists tt_emails (     id int primary key auto_increment,     util_account_id varchar(40) null,     email varchar(344) not null,     optout int not null     );  load data infile '/shared/implementation/emails.tsv'     table tt_emails (util_account_id, email, optout); 

the emails.tsv file has 3 columns, while temporary table made has 4. i'm not sure if correct syntax; included 4th column have id primary key column.

i following error when run code:

error 13 (hy000): can't stat of '/nfs/shared/implementation/ngma/co-48812_ngma_load_email/exclude_emails.tsv' (errcode: 13) 

it's unix/linux file system permissions problem.

the operating system not allowing os user permission access specified file.

the permission on every directory in path file must @ least read+execute, , permission on file must @ least read.

the os user attempting access file unix/linux user account mysql server process running as. (that "mysql", doesn't have be, depends on how mysql installed , setup.

from shell prompt on mysql server host, run

ps -ef | grep mysqld 

the output should contain line contains mysqld. example:

mysql      2247  1233  0 mar21 ?    00:24:09 /opt/mysql/bin/mysqld --basedir=/opt/... 

that first field in output shows os user mysql server running under. in case, it's os user "mysql"

if login os "mysql", or "su - mysql" switch user), have same permissions issue attempting access file.

/nfs/shared/implementation/ngma/co-48812_ngma_load_email/exclude_emails.tsv 

either permissions on file don't allow os user "mysql" read file, or permissions on directories above file don't allow "read+execute" os user "mysql".

the permissions on directories , files need changed appropriately.


as kludgy workaround, copy file /tmp (from shell prompt, logged in os user have "read" permission on file). /tmp directory should allow "read+execute" everyone, including os user "mysql"

 cp /nfs/shared/implementation/ngma/co-48812_ngma_load_email/exclude_emails.tsv /tmp/  

and can change permissions on file allow os user "mysql" read file. make file readable everyone:

 chmod ugo+r /tmp/exclude_emails.tsv 

then connect mysql server , try unning load data referencing new /tmp/exclude_emails.tsv file.

your other option of course set permissions appropriately on original file (so "mysql" user (or whatever os user mysqld running as) has necessary permissions, , on of directories in path.

to summarize... isn't mysql server issue. it's issue operating systems permissions prohibit access file mysql os user trying perform.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -