Guides & TutorialsTroubleshootingAdvancedResolving a Base table or view not found Error

Resolving a Base table or view not found Error

Introduction

This guide demonstrates how to resolve a Base table or view not found error which may be encountered during normal operation of WHMCS. The full error may look like:

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

Cause

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

In this example the tbldomainpricing_premium table does not exist. It should be present.

A missing table could be caused by an update failure in the past, or accidental/malicious removal of the table.

Resolution

The table identified by the error message must be re-created. Follow these steps:

1. Navigate to the /resources/sql/install/ directory

2. Identify the .schema.sql file with the filename corresponding to the missing table name. In this example that's tbldomainpricing_premium.schema.sql:

Open the .schema.sql file for the missing table

3. Edit the file to view its contents

4. Copy the SQL CREATE TABLE command shown in the file. For example:

Identify the CREATE Table command

5. Using a database administration tool such as phpmyadmin, execute the SQL command copied from the .schema.sql file. For example:

Execute the CREATE TABLE command against the WHMCS Database

6. Ensure the create query executes successfully:

Command Successful

7. You may now return to WHMCS and the error resolved. 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.