Error Code 2002 with Local MySQL Database

On This Page:

Revive Adserver Installation Fails with Local MySQL Database: Error Code 2002

A troubleshooting guide to help when Revive Adserver won't install when using a locally installed MySQL as the database, reporting (among other things), an Error Code of 2002.

 


Symptoms

During a new installation of Revive Adserver when using a MySQL Database, Revive Adserver gives an error code of 2002.

Other errors may also be shown, such as:

  • No such file or directory;
  • Can't connect to local MySQL server through socket '/some/path/to/mysql.sock'.

Troubleshooting Process

When using a locally installed MySQL server, if the Database Hostname is set to "localhost", then PHP will attempt to use a local socket connection to MySQL, even when a TCP/IP connection is requested (which is the Revive Adserver default).

As a result, if the default path to the mysql.sock file defined in your PHP's php.ini file is not correct for your MySQL installation, then using a hostname of "localhost" will result in the above error.

To resolve the issue, either:

  • Use "127.0.0.1" as the Database Hostname, instead of "localhost", to force PHP to use a TCP/IP connection; or
  • Edit your PHP's php.ini file to correctly define the default location of your MySQL database's mysql.sock file.