Could not connect to database: No such file or directory

Question:

When accessing Centova Cast I see the following error message:

Could not connect to database: No such file or directory

What does this mean and how do I fix it?

Answer:

This means that Centova Cast cannot connect to your database for some reason.

Possible causes for this include:

  • Your MySQL server isn't running. Start your MySQL server to fix this.

  • You specified the wrong IP address or hostname for MySQL, or the IP address/hostname has changed. Edit /usr/local/centovacast/etc/centovacast.conf and make sure the DB_HOST option is set correctly.

  • Your MySQL server is listening on a UNIX domain socket at an unusual location, and Centova Cast was unable to detect the UDS location during installation.

    To find your UDS path, try running:

    ps aux | grep mysql | grep socket
    

    You should see something like:

    mysql     1945  0.1 12.8 562728 32792 ?        Sl   Mar04 182:31 /usr/sbin/mysqld
       --socket=/var/run/mysqld/mysqld.sock --pid-file=/var/run/mysqld/mysqld.pid
    

    The UDS path specified after the --socket parameter; i.e., in the above example it's /var/run/mysqld/mysqld.sock. If the command above does not display the UDS path, you'll need to find your MySQL configuration file (usually /etc/mysql/my.cnf) and look inside it for the socket = option.

    Finally, edit /usr/local/centovacast/etc/cc-system.conf and make sure the mysql.default_socket option is set to the correct UDS path.