"Error SQLSTATE[HY000] [2002] No such file or directory" when installing Matomo

I’m trying to install Matomo and uploaded the files into an empty directory. When I access the URL, I see the welcome screen. Then I click next and instead of the system check (…/index.php?action=systemCheck) I see “An error occurred SQLSTATE[HY000] [2002] No such file or directory”. I re-uploaded the files and used the provider’s tool to repair permissions, they should be all OK.
The server is Apache (I tried with PHP 7.4.14 and 8.0.1) on shared hosting (I cannot configure Apache) and I run several other PHP applications with database access (e.g. WordPress) on the same hosting, so basically database access should work.
I installed Piwik/Matomo on several other servers and never ran into that problem.
Any ideas where could be the cause? Thanks!

Update: I uploaded all files again, this time expressively “binary mode”. Now I can get to the next screen. :slightly_smiling_face: Maybe this was the reason.

1 Like


Can you elaborate more please? I’m running to the same problem
did you just recopy the folder?

I think the download mode has been set to binary instead of text

1 Like

Yes, I uploaded all files and folders again, this time with upload mode set to “binary” instead of “automatic”.

1 Like

I guess then it’s not relevant to my problem, I’m cloning git rep.

Thanks for the fast reply guys!

Hello, I have the same problem: I’m cloning a working git repo but after clicking “next” in the first screen of the installation proccess I get this error.

Did you solve this?

Thanks in advance

for me it didn’t work this way (cloning from git)

I had to copy it with a USB disk from another developer (yep)

@no-on3, @adri: Did you set the MySQL credentials accurately?

I can’t because after the first screen I get the error:



i copied the whole project with config file and database (it worked this way)

but as Adrian said, while installing the first time, it just keeps saying that error

Maybe some rights/permissions on file-system by Apache user?