Resolving a Base table or view not found Error
When applying an update to the WHMCS software an error stating Base table or view not found is displayed. The full error may look like:
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
This guide demonstrates how to resolve this error.
This error occurs when a table does not exist in the WHMCS MySQL database, but the update process needs to make a change to that table.
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.
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:
3. Edit the file to view its contents
4. Copy the SQL CREATE TABLE command shown in the file. For example:
5. Using a database administration tool such as phpmyadmin, execute the SQL command copied from the .schema.sql file. For example:
6. Ensure the create query executes successfully:
7. You may now return to WHMCS and re-run the update process.