简体   繁体   中英

CAKEPHP SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cms_database.users' doesn't exist. iam using cakephp 4

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

Could this be caused by using Auto-Tables? Some of the Table objects in your application were created by instantiating "Cake\ORM\Table" instead of any other specific subclass.

This could be the cause for this exception. Auto-Tables are created for you under the following circumstances:

The class for the specified table does not exist. The Table was created with a typo: $this->getTableLocator()->get('Atricles'); The class file has a typo in the name or incorrect namespace: class Atricles extends Table The file containing the class has a typo or incorrect casing: Atricles.php The Table was used using associations but the association has a typo: $this->belongsTo('Atricles') The table class resides in a Plugin but no plugin notation was used in the association definition.

Please try correcting the issue for the following table aliases:

Users

Thanks for your concern..

I solved my error..

I place this resolver method code in my Application.php file to change default users table to admins table. here is the code-

$authenticationService->loadIdentifier('Authentication.Password', [
    'fields' => [
        'username' => 'username',
        'password' => 'password',
        
    ],
    
    'resolver' => [
    'className' => 'Authentication.Orm',
    'userModel' => 'Admins',
    ]
]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM