andreask7 / lwt

Learning with Texts (LWT) is a tool for Language Learning. The official version (not this one) is available at :
http://lwt.sf.net
Other
33 stars 7 forks source link

Access denied, LOAD DATA INFILE #17

Closed ghost closed 8 years ago

ghost commented 8 years ago

It seems LOAD DATA INFILE isn't available on some shared hosting services. At least it is blocked at hostgator. Any workaround?

Fatal Error in SQL Query: LOAD DATA INFILE '/tmp/lwt/tmpti.txt' INTO TABLE temptextitems FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' (@c) set TiOrder = if(@c="\r",@a,@a:=@a+1), TiText = @c, TiSeID = if(@c="\r",@b:=@b+1,@b),TiWordCount=('¶.!?:;。!?:;' not like concat("%",@c,"%")) and (!(@c rlike '[^一-龥]+')), TiCount = IF(@c="\r",(@d:= 0), (@d:=@d+CHAR_LENGTH(@c))+1-CHAR_LENGTH(@c))

Error Code & Message: [1045] Access denied for user '****'@'localhost' (using password: YES)

andreask7 commented 8 years ago

Hello jo91,

can you change LOAD DATA INFILE into LOAD DATA LOCAL INFILE in utilities.inc.php (line:3237) and check if it works

ghost commented 8 years ago

Thanks for the quick answer. I will try it later. I moved now to Linode, so it isn't an issue for me anymore. By the way, in your version 1.6.27, when setting "Make each charachter a word" , an empty space is inserted between each word. (see demo-database chinese ) . Is this a feature or a bug?

feanarosurion commented 8 years ago

I can confirm this issue. It only started since updated to 1.6.27. Just a report, I haven't done any further digging at this time.

feanarosurion commented 8 years ago

Tried the suggested fix. Below is my error:

Fatal Error in SQL Query: LOAD DATA LOCAL INFILE '/tmp/lwt/tmpti.txt' INTO TABLE temptextitems FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' (@c) set TiOrder = if(@c="\r",@a,@a:=@a+1), TiText = @c, TiSeID = if(@c="\r",@b:=@b+1,@b),TiWordCount=('¶.!?:;' not like concat("%",@c,"%")) and (!(@c rlike '[^-\'a-zA-ZÀ-ÖØ-öø-ȳЀ-ӹ]+')), TiCount = IF(@c="\r",(@d:= 0), (@d:=@d+CHAR_LENGTH(@c))+1-CHAR_LENGTH(@c)) Error Code & Message: [1267] Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'regexp'

feanarosurion commented 8 years ago

So I guess by clarification, the suggested fix worked as far as permissions go but it looks like the database has a collations issue. Tried reverting back to version 1.6.24 and now there's a column error problem.

ghost commented 8 years ago

I got the same error. There is an easy fix. Go to phpmyadmin. In operation tab change the collation of your database from latin1_swedish_ci to utf8_general_ci. Now it should work

feanarosurion commented 8 years ago

Thanks for the tip jo91! That worked. Issue is fixed with the combination of collation and the LOCAL permission in the SQL as suggested.