Load data infile

Be aware of the issues you may now face by not having open_basedir enabled.

Thanks for the discussion and tips. I added them in a new FAQ: How do I make LOAD DATA INFILE work on my server?

If you can think of improvement to this FAQ (or others) you can use the feedback form at end of page (or post here)

In my case, adding “adapter = MYSQLI” fixed the bug on my Piwik.

Hello,

I also got the problem with the LOAD DATA INFILE and can’t get it to work.
Im using Ubuntu 12.04.

As I’m no coder and English isn’t my mother tongue, I perhaps don’t understand every solution I found about this problem.

Here is what I tried so far:

In Plesk I changed file privileges: db_username_for_piwik localhost global ALL PRIVILEGES Yes
After that I restarted MySQL.

Although it changed, I still got an error message in Piwik:


Try #1: LOAD DATA INFILE : SQLSTATE[HY000]: General error: 13 Can't get stat of '/var/www/vhosts/my_domain/httpdocs/piwik/tmp/assets/option-f91938e5e.....csv' (Errcode: 13)

In the FAQ is suggested to make some changes to the apparmor settings. However, apparmor isn’t active on my system, so this is not the solution for my case.

I also tried to change the setting of my.cnf, but it had no effect on the error message ;-(

I hope someone can help me out and give me a solution which is untderstandable for a non professional.

Thank you in advance.

try also to do this step of the FAQ?

give the process mysqld executable-access (+x) to files in path/to/piwik/tmp/assets/* and all parent folders.

Hi,

this is one part of the FAQ, that I did not understand.
How can I change these settings?

Can you give me easy understandable instructions for that matter.

Thank you in advance.

Using FTP software, right click on the directory and check the “Executable” checkbox, maybe this helps?

No, it does not ;-(

I may have an idea why PDO with LOAD DATA INFILE does not work. It’s bugged when PHP is configured in a special way:

The LOAD DATA LOCAL INFILE function does not work with mysql5.5 and php5.4.4 on Debian Wheezy with open_basedir restrictions in place.
It works perfectly fine when open_basedir is disabled or set to nothing.

Ref: PHP :: Bug #55737 :: LOAD DATA LOCAL INFILE - The used command is not allowed with this MySQL versio

Do you have open_basedir restriction enabled in PHP configs?

Hello,

I just updatet to Piwik 2.2.2. After that I changed my php.ini (etc/php5/apache2/php.ini), included the line …


open_basedir =

… and restartet apache and mysql …


/etc/init.d/apache2 restart 
/etc/init.d/mysql restart

However, there is still this error message in Piwik:


Fehler: 
Try #1: LOAD DATA INFILE : SQLSTATE[HY000]: General error: 13 Can't get stat of '/var/www/vhosts/xxx.de/httpdocs/piwik/tmp/assets/option-90b729b1256abe09fbdde1c76e6e442a.csv' (Errcode: 13)

I also set chmod for the folders piwik tmp and assets (/piwik/tmp/assets/) to 7777.
Owner and group are set to www-data [33] (these settings were made by Piwik).

I hope that was correct according to the instructions.

777 or 7777 is bad. Do not use those perms! Fix the issue at hand and use proper permissions. Those two perms are not a solution but a hacky fix at best.


 Fix the issue at hand and use proper permissions.

How to do so?

It still doesn’t work and I still don’t know/understand how to fix it.

I am using SSL, debian, MYSQLI and hhvm.

Editing /etc/hhvm/php.ini and setting:

open_basedir =

then restarting hhvm service, made the job.

What MySQL Server version do you use?

Version du serveur: 5.5.28-1
Version du protocole: 10
UTF-8 Unicode (utf8)

Apache/2.2.22 (Debian)
Version du client MySQL: 5.5.28
Extension PHP: mysqli