Migrations Error: Failed to Open Referenced Table

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, mainapp, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying mainapp.0001_initial...Traceback (most recent call last):
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\mysql\base.py", line 75, in execute
    return self.cursor.execute(query, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
    res = self._query(mogrified_query)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
    db.query(q)
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\connections.py", line 255, in query
    _mysql.connection.query(self, query)
MySQLdb.OperationalError: (1824, "Failed to open the referenced table 'auth_group'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\bankingproject\manage.py", line 22, in <module>
    main()
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\bankingproject\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\commands\migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
                         ^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
            ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\migrations\executor.py", line 249, in apply_migration
    with self.connection.schema_editor(
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\base\schema.py", line 166, in __exit__
    self.execute(sql)
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\base\schema.py", line 201, in execute
    cursor.execute(sql, params)
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 102, in execute
    return super().execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 67, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\mysql\base.py", line 75, in execute
    return self.cursor.execute(query, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
    res = self._query(mogrified_query)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
    db.query(q)
  File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\connections.py", line 255, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1824, "Failed to open the referenced table 'auth_group'")

i got this error when am trying to run migrations in my django project development can anyone help me on this honestly i have been battling with this for the pass few days, in my project i have 2 apps but the first app have the custom user model and as per the database the structure looks like this in the settings for example,

DATABASES = {
    'default': {},
    'auth_db': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'Migration errro',
        'USER': 'root',
        'PASSWORD': ''Django Migration errro',
        'HOST': 'localhost', 
        'PORT': '', 
    },
    'first_app_db': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'second_app',
        'USER': 'root',
        'PASSWORD': ''Django Migration errro',
        'HOST': 'localhost',  
        'PORT': '', 
    },
    'second_app_db': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'second_app',
        'USER': 'root',
        'PASSWORD': 'Django Migration error',
        'HOST': 'localhost',
        'PORT': '', 
    },
} 

honestly everything in my project looks correct including the database router, when i run makemigrations for the both app it runs successful and correctly but when i tried to run migrations for the Django auth, contenttype, seasons and admin it throw this error,

 packages\MySQLdb\connections.py", line 255, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1824, "Failed to open the referenced table 'Customusermodel'")

and when i also try to run migration for the first app that have the custom user model it also throw an error,

packages\MySQLdb\connections.py", line 255, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1824, "Failed to open the referenced table 'auth_group'")

please can some help me out on how i can solve this error

First, you must have a default database - from ‘DATABASES’

The DATABASES setting must configure a default database; any number of additional databases may also be specified.

Second, the posted configuration you show here has syntax errors for the ‘PASSWORD’ settings.

It would also help if you posted your mainapp.models file.

as per the password in the DATABASE it correct in the settings this is just an example that i was trying to use to tell how the database structure looks like and sorry for the typo
Here is how the custom user model looks like in the first app(mainapp)

from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
from django.conf import settings
from django.utils import timezone
import uuid
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission, Group
from django.utils.translation import gettext_lazy as _

class CustomUserManager(BaseUserManager):
    def _create_user(self, username, email, password, **extra_fields):
        if not email:
            raise ValueError("Email must be provided")
        if not password:
            raise ValueError("Password is not provided")

        email = self.normalize_email(email)
        user = self.model(username=username, email=email, **extra_fields)
        user.set_password(password)
        user.save(using=self._db)
        return user
        
    def create_user(self, username, email, password, **extra_fields):
        extra_fields.setdefault('is_staff', False)
        extra_fields.setdefault('is_active', True)
        extra_fields.setdefault('is_superuser', False)
        return self._create_user(username, email, password, **extra_fields)
    
    def create_superuser(self, username, email, password, **extra_fields):
        extra_fields.setdefault('is_staff', True)
        extra_fields.setdefault('is_active', True)
        extra_fields.setdefault('is_superuser', True)
        return self._create_user(username, email, password, **extra_fields)

class CustomUserModel(AbstractBaseUser, PermissionsMixin):
    username = models.CharField(max_length=150, unique=True)
    email = models.EmailField(max_length=255, unique=True)
    is_active = models.BooleanField(default=True)
    is_staff = models.BooleanField(default=False)
    date_joined = models.DateTimeField(default=timezone.now)

    class Meta:
        db_table = "Users"

    objects = CustomUserManager()

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['username']

    def __str__(self):
        return self.email
    
    groups = models.ManyToManyField(
        Group,
        verbose_name=_('groups'),
        blank=True,
        help_text=_('The groups this user belongs to.'),
        related_name='custom_user_set'
    )
    user_permissions = models.ManyToManyField(
        Permission,
        verbose_name=_('user permissions'), 
        blank=True,
        help_text=_('Specific permissions for this user.'),
        related_name='custom_user_set'
    )
   
class Profile(models.Model):
    user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='profile')
    first_name = models.CharField(max_length=50)
    middle_name = models.CharField(max_length=50, blank=True, null=True)
    last_name = models.CharField(max_length=50)
    date_of_birth = models.DateField(blank=True, null=True)
    phone = models.CharField(max_length=20, unique=True)

    class Meta:
          db_table = "Profile"

above is the class structure in the first app models
thanks for showing concern KenWhitesell