cancel
Showing results for 
Search instead for 
Did you mean: 

Base table or view not found: 1146 Table 'table.admin_user_expiration' doesn't exist

Base table or view not found: 1146 Table 'table.admin_user_expiration' doesn't exist

I've been trying to restore a backed up version but after a day or so the admin panel keeps showing:

2 exception(s):
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'table.admin_user_expiration' doesn't exist, query was: SELECT `main_table`.*, `user`.`is_active` FROM `admin_user_expiration` AS `main_table`
 LEFT JOIN `admin_user` AS `user` ON main_table.user_id = user.user_id WHERE (`expires_at` < '2021-12-30 04:09:40') AND (`user`.`is_active` = '1') AND (`main_table`.`user_id` = '2')
Exception #1 (PDOException): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'printbu1_mclient.admin_user_expiration' doesn't exist

 

The front-end shows properly just the admin panel constantly gives me the same table issue, i can't seem to find anything online is there any way i can resolve this?

 

Thanks

3 REPLIES 3

Re: Base table or view not found: 1146 Table 'table.admin_user_expiration' doesn't exist

@rpoonprinta1ec 

Check whether the below database table exists or not:

admin_user_expiration
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Base table or view not found: 1146 Table 'table.admin_user_expiration' doesn't exist

So the admin_user_expiration does not exist.

 

Do I just recreate the table? what would the columns be?

 

The werid thing is that after I restore the backup it works fine but after a few hours the admin panel stops working and starts displaying the sql db error.

 

Thank you for your repsonse!

Re: Base table or view not found: 1146 Table 'table.admin_user_expiration' doesn't exist

CREATE TABLE `admin_user_expiration` (
`user_id` int(10) UNSIGNED NOT NULL COMMENT 'User ID',
`expires_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'User Expiration Date'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Admin User expiration dates table';

ALTER TABLE `admin_user_expiration`
ADD PRIMARY KEY (`user_id`);

ALTER TABLE `admin_user_expiration`
ADD CONSTRAINT `MG_ADMIN_USER_EXPIRATION_USER_ID_MG_ADMIN_USER_USER_ID` FOREIGN KEY (`user_id`) REFERENCES `admin_user` (`user_id`) ON DELETE CASCADE;
COMMIT;