Base Table or View Not Found Errors

Problem

You see one of the following errors:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'table_whmcs7.tbldomainpricing_premium' doesn't exist

or

Unable to complete incremental updates: Unable to import the 8.0.0  Alpha1 database file.
Unable to import  /path/to/whmcs/resources/sql/upgrade800alpha1.sql:  SQLSTATE[42S02]:
Base table or view not found: 1146 Table 'table_whmcs7.tbldomainpricing_premium' doesn't exist

Cause

This error occurs when a required table is missing from the WHMCS MySQL® database.

In the first example above, the tbldomainpricing_premium table does not exist.

This issue could occur because of an update failure or accidental or malicious removal of the table.

Solution

To resolve this issue, recreate the table:

  1. Go to the /resources/sql/install/ directory.
  2. Identify the .schema.sql file with the filename corresponding to the missing table name
  3. Edit the file to view its contents.
  4. Copy the SQL CREATE TABLE command in the file. For example:
    The CREATE TABLE command.
  5. Using a database administration tool (for example, phpMyAdmin), execute the copied SQL command. Make certain that it runs successfully.
  6. Repeat the process for any other missing tables.
If multiple tables are missing, this may indicate a wider issue on the MySQL server, necessitating investigation by a server administrator instead.

Last modified: October 29, 2024