Error while trying to connect to the MySQL database:
SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘’ (111)
when trying to go through Step 3 of Install.
I’ve set up a new DB, and have specified the existing super-user DB account credentials. As I understand it tho, this error doesn’t result from credential failure but from a basic connection problem. MySQL is running on localhost, on the default port; it’s a shared hosting server but PHP/MySQL is working fine with our own sites.
MySQL server version: 5.0.41
PHP version 5.2.6, with MySQL/MySQLi client API version 5.0.41
So - no, looks like the client and server versions match here, unless there’s an issue with that specific version? Thanks for the suggestion though - I hadn’t thought of checking that.
The odd thing is that we’ve never had any other DB issues between PHP and MySQL, using both MySQL and MySQLi client APIs - they run all our websites on that server! So what does Piwik do differently?
No, 111 is the MySQL error code, not the port (111 seems to be the catch-all for “something went wrong when I tried to connect”!) However your question made me realise something else which was staring us in the face - from the wording of the error message, it looks like it isn’t trying to connect through a port at all, but is trying to use a socket! Presumably the hosting provider has disabled local socket connections.
I replaced the default ‘localhost’ host entry on the form with 127.0.0.1, and that seems to have been enough to force Piwik to connect via IP port instead of a pipe as the install then worked perfectly!
While this isn’t exactly a bug, it’s surely something users should be warned about (or the default host on that installation form should be replaced with 127.0.0.1 to make sure this doesn’t happen)?