Can’t login to CyberPanel - 1049, "Unknown database 'cyberpanel'"

I can’t login to CyberPanel :8090 page:

OperationalError at /
(1049, "Unknown database 'cyberpanel'")
Request Method:	GET
Request URL:	https://XX.XX.XXX.XX:8090/
Django Version:	3.0.1
Exception Type:	OperationalError
Exception Value:	
(1049, "Unknown database 'cyberpanel'")
Exception Location:	/usr/local/CyberCP/lib/python3.8/site-packages/MySQLdb/connections.py in __init__, line 179
Python Executable:	/usr/local/CyberCP/bin/python
Python Version:	3.8.10
Python Path:	
['',
 '/usr/local/CyberCP/bin',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP/lib/python38.zip',
 '/usr/local/CyberCP/lib/python3.8',
 '/usr/local/CyberCP/lib/python3.8/lib-dynload',
 '/usr/lib/python3.8',
 '/usr/local/CyberCP/lib/python3.8/site-packages',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP']

Meta

CSRF_COOKIE	
'N7F37p1ikANfhRX7Xd7wWdcLLHKyA6RHGYe7PB2ZkgABIBgoFWdSrvgdaZXsIrke'
CSRF_COOKIE_USED	
True
HAVE_REWITE	
'1'
HTTPS	
'on'
HTTP_ACCEPT	
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
HTTP_ACCEPT_ENCODING	
'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE	
'en,pt-BR;q=0.9,pt;q=0.8,en-US;q=0.7'
HTTP_CONNECTION	
'keep-alive'
HTTP_COOKIE	
'csrftoken=N7F37p1ikANfhRX7Xd7wWdcLLHKyA6RHGYe7PB2ZkgABIBgoFWdSrvgdaZXsIrke'
HTTP_HOST	
'XX.XX.XXX.XX:8090'
HTTP_SEC_CH_UA	
'" Not A;Brand";v="99", "Chromium";v="104", "Opera";v="90"'
HTTP_SEC_CH_UA_MOBILE	
'?0'
HTTP_SEC_CH_UA_PLATFORM	
'"Windows"'
HTTP_SEC_FETCH_DEST	
'document'
HTTP_SEC_FETCH_MODE	
'navigate'
HTTP_SEC_FETCH_SITE	
'none'
HTTP_SEC_FETCH_USER	
'?1'
HTTP_UPGRADE_INSECURE_REQUESTS	
'1'
HTTP_USER_AGENT	
('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like '
 'Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.54')
LSWS_EDITION	
'Openlitespeed 0.2.7'
PATH_INFO	
'/'
QUERY_STRING	
''
REMOTE_ADDR	
'XX.XX.XXX.XX'
REMOTE_PORT	
'52911'
REQUEST_METHOD	
'GET'
REQUEST_URI	
'/'
SCRIPT_NAME	
''
SERVER_ADDR	
'XX.XX.XXX.XX'
SERVER_ADMIN	
''
SERVER_NAME	
'XX.XX.XXX.XX'
SERVER_PORT	
'8090'
SERVER_PROTOCOL	
'HTTP/1.1'
SERVER_SOFTWARE	
'LiteSpeed'
SSL_CIPHER	
'TLS_CHACHA20_POLY1305_SHA256'
SSL_CIPHER_ALGKEYSIZE	
'256'
SSL_CIPHER_USEKEYSIZE	
'256'
SSL_PROTOCOL	
'TLSv1.3'
X-LSCACHE	
'on,crawler'
wsgi.errors	
<_io.TextIOWrapper name='<stderr>' mode='w' encoding='ascii'>
wsgi.file_wrapper	
''
wsgi.input	
<lsapi_wsgi.InputStream object at 0x7f3ba6052af0>
wsgi.multiprocess	
True
wsgi.multithread	
False
wsgi.run_once	
False
wsgi.url_scheme	
'https'
wsgi.version	
(1, 0)

Settings module CyberCP.settings

ABSOLUTE_URL_OVERRIDES	
{}
ADMINS	
[]
ALLOWED_HOSTS	
['*']
APPEND_SLASH	
True
AUTHENTICATION_BACKENDS	
['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS	
'********************'
AUTH_USER_MODEL	
'auth.User'
BASE_DIR	
'/usr/local/CyberCP'
CACHES	
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS	
'default'
CACHE_MIDDLEWARE_KEY_PREFIX	
'********************'
CACHE_MIDDLEWARE_SECONDS	
600
CSRF_COOKIE_AGE	
31449600
CSRF_COOKIE_DOMAIN	
None
CSRF_COOKIE_HTTPONLY	
False
CSRF_COOKIE_NAME	
'csrftoken'
CSRF_COOKIE_PATH	
'/'
CSRF_COOKIE_SAMESITE	
'Lax'
CSRF_COOKIE_SECURE	
False
CSRF_FAILURE_VIEW	
'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME	
'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS	
[]
CSRF_USE_SESSIONS	
False
DATABASES	
{'default': {'ATOMIC_REQUESTS': False,
             'AUTOCOMMIT': True,
             'CONN_MAX_AGE': 0,
             'ENGINE': 'django.db.backends.mysql',
             'HOST': 'localhost',
             'NAME': 'cyberpanel',
             'OPTIONS': {},
             'PASSWORD': '********************',
             'PORT': '',
             'TEST': {'CHARSET': None,
                      'COLLATION': None,
                      'MIRROR': None,
                      'NAME': None},
             'TIME_ZONE': None,
             'USER': 'cyberpanel'},
 'rootdb': {'ATOMIC_REQUESTS': False,
            'AUTOCOMMIT': True,
            'CONN_MAX_AGE': 0,
            'ENGINE': 'django.db.backends.mysql',
            'HOST': 'localhost',
            'NAME': 'mysql',
            'OPTIONS': {},
            'PASSWORD': '********************',
            'PORT': '',
            'TEST': {'CHARSET': None,
                     'COLLATION': None,
                     'MIRROR': None,
                     'NAME': None},
            'TIME_ZONE': None,
            'USER': 'root'}}
DATABASE_ROUTERS	
['backup.backupRouter.backupRouter']
DATA_UPLOAD_MAX_MEMORY_SIZE	
52428800
DATA_UPLOAD_MAX_NUMBER_FIELDS	
1000
DATETIME_FORMAT	
'N j, Y, P'
DATETIME_INPUT_FORMATS	
['%Y-%m-%d %H:%M:%S',
 '%Y-%m-%d %H:%M:%S.%f',
 '%Y-%m-%d %H:%M',
 '%Y-%m-%d',
 '%m/%d/%Y %H:%M:%S',
 '%m/%d/%Y %H:%M:%S.%f',
 '%m/%d/%Y %H:%M',
 '%m/%d/%Y',
 '%m/%d/%y %H:%M:%S',
 '%m/%d/%y %H:%M:%S.%f',
 '%m/%d/%y %H:%M',
 '%m/%d/%y']
DATE_FORMAT	
'N j, Y'
DATE_INPUT_FORMATS	
['%Y-%m-%d',
 '%m/%d/%Y',
 '%m/%d/%y',
 '%b %d %Y',
 '%b %d, %Y',
 '%d %b %Y',
 '%d %b, %Y',
 '%B %d %Y',
 '%B %d, %Y',
 '%d %B %Y',
 '%d %B, %Y']
DEBUG	
True
DEBUG_PROPAGATE_EXCEPTIONS	
False
DECIMAL_SEPARATOR	
'.'
DEFAULT_CHARSET	
'utf-8'
DEFAULT_EXCEPTION_REPORTER_FILTER	
'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE	
'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL	
'webmaster@localhost'
DEFAULT_INDEX_TABLESPACE	
''
DEFAULT_TABLESPACE	
''
DISALLOWED_USER_AGENTS	
[]
EMAIL_BACKEND	
'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST	
'localhost'
EMAIL_HOST_PASSWORD	
'********************'
EMAIL_HOST_USER	
''
EMAIL_PORT	
25
EMAIL_SSL_CERTFILE	
None
EMAIL_SSL_KEYFILE	
'********************'
EMAIL_SUBJECT_PREFIX	
'[Django] '
EMAIL_TIMEOUT	
None
EMAIL_USE_LOCALTIME	
False
EMAIL_USE_SSL	
False
EMAIL_USE_TLS	
False
FILE_CHARSET	
'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS	
None
FILE_UPLOAD_HANDLERS	
['django.core.files.uploadhandler.MemoryFileUploadHandler',
 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE	
2621440
FILE_UPLOAD_PERMISSIONS	
420
FILE_UPLOAD_TEMP_DIR	
None
FIRST_DAY_OF_WEEK	
0
FIXTURE_DIRS	
[]
FORCE_SCRIPT_NAME	
None
FORMAT_MODULE_PATH	
None
FORM_RENDERER	
'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS	
[]
INSTALLED_APPS	
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'baseTemplate',
 'loginSystem',
 'packages',
 'websiteFunctions',
 'tuning',
 'serverStatus',
 'dns',
 'ftp',
 'userManagment',
 'databases',
 'mailServer',
 'serverLogs',
 'firewall',
 'backup',
 'managePHP',
 'manageSSL',
 'api',
 'filemanager',
 'manageServices',
 'pluginHolder',
 'emailPremium',
 'emailMarketing',
 'cloudAPI',
 'highAvailability',
 's3Backups',
 'dockerManager',
 'containerization',
 'CLManager',
 'IncBackups',
 'WebTerminal']
INTERNAL_IPS	
[]
LANGUAGES	
(('en', 'English'),
 ('cn', 'Chinese'),
 ('br', 'Bulgarian'),
 ('pt', 'Portuguese'),
 ('ja', 'Japanese'),
 ('bs', 'Bosnian'),
 ('gr', 'Greek'),
 ('ru', 'Russian'),
 ('tr', 'Turkish'),
 ('es', 'Spanish'),
 ('fr', 'French'),
 ('pl', 'Polish'),
 ('vi', 'Vietnamese'),
 ('it', 'Italian'),
 ('de', 'Deutsch'),
 ('id', 'Indonesian'),
 ('bn', 'Bangla'))
LANGUAGES_BIDI	
['he', 'ar', 'fa', 'ur']
LANGUAGE_CODE	
'en'
LANGUAGE_COOKIE_AGE	
None
LANGUAGE_COOKIE_DOMAIN	
None
LANGUAGE_COOKIE_HTTPONLY	
False
LANGUAGE_COOKIE_NAME	
'django_language'
LANGUAGE_COOKIE_PATH	
'/'
LANGUAGE_COOKIE_SAMESITE	
None
LANGUAGE_COOKIE_SECURE	
False
LOCALE_PATHS	
('/usr/local/CyberCP/locale',)
LOGGING	
{}
LOGGING_CONFIG	
'logging.config.dictConfig'
LOGIN_REDIRECT_URL	
'/accounts/profile/'
LOGIN_URL	
'/accounts/login/'
LOGOUT_REDIRECT_URL	
None
MANAGERS	
[]
MEDIA_ROOT	
'/usr/local/CyberCP/tmp/'
MEDIA_URL	
'/usr/local/CyberCP/tmp/'
MESSAGE_STORAGE	
'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE	
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'CyberCP.secMiddleware.secMiddleware']
MIGRATION_MODULES	
{}
MONTH_DAY_FORMAT	
'F j'
NUMBER_GROUPING	
0
PASSWORD_HASHERS	
'********************'
PASSWORD_RESET_TIMEOUT_DAYS	
'********************'
PREPEND_WWW	
False
ROOT_URLCONF	
'CyberCP.urls'
SECRET_KEY	
'********************'
SECURE_BROWSER_XSS_FILTER	
False
SECURE_CONTENT_TYPE_NOSNIFF	
True
SECURE_HSTS_INCLUDE_SUBDOMAINS	
False
SECURE_HSTS_PRELOAD	
False
SECURE_HSTS_SECONDS	
0
SECURE_PROXY_SSL_HEADER	
None
SECURE_REDIRECT_EXEMPT	
[]
SECURE_REFERRER_POLICY	
None
SECURE_SSL_HOST	
None
SECURE_SSL_REDIRECT	
False
SERVER_EMAIL	
'root@localhost'
SESSION_CACHE_ALIAS	
'default'
SESSION_COOKIE_AGE	
1209600
SESSION_COOKIE_DOMAIN	
None
SESSION_COOKIE_HTTPONLY	
True
SESSION_COOKIE_NAME	
'sessionid'
SESSION_COOKIE_PATH	
'/'
SESSION_COOKIE_SAMESITE	
'Lax'
SESSION_COOKIE_SECURE	
False
SESSION_ENGINE	
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE	
False
SESSION_FILE_PATH	
None
SESSION_SAVE_EVERY_REQUEST	
False
SESSION_SERIALIZER	
'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE	
'CyberCP.settings'
SHORT_DATETIME_FORMAT	
'm/d/Y P'
SHORT_DATE_FORMAT	
'm/d/Y'
SIGNING_BACKEND	
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS	
[]
STATICFILES_DIRS	
[]
STATICFILES_FINDERS	
['django.contrib.staticfiles.finders.FileSystemFinder',
 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE	
'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT	
'/usr/local/CyberCP/static/'
STATIC_URL	
'/static/'
TEMPLATES	
[{'APP_DIRS': True,
  'BACKEND': 'django.template.backends.django.DjangoTemplates',
  'DIRS': ['/usr/local/CyberCP/templates'],
  'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
                                     'django.template.context_processors.request',
                                     'django.contrib.auth.context_processors.auth',
                                     'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS	
[]
TEST_RUNNER	
'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR	
','
TIME_FORMAT	
'P'
TIME_INPUT_FORMATS	
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE	
'UTC'
USE_I18N	
True
USE_L10N	
True
USE_THOUSAND_SEPARATOR	
False
USE_TZ	
True
USE_X_FORWARDED_HOST	
False
USE_X_FORWARDED_PORT	
False
WSGI_APPLICATION	
'CyberCP.wsgi.application'
X_FRAME_OPTIONS	
'DENY'
YEAR_MONTH_FORMAT	
'F Y'

Now i have another error… :rofl:

OperationalError at /
(1045, "Access denied for user 'cyberpanel'@'localhost' (using password: YES)")
Request Method:	GET
Request URL:	https://XX.XX.XXX.XX:8090/
Django Version:	3.0.1
Exception Type:	OperationalError
Exception Value:	
(1045, "Access denied for user 'cyberpanel'@'localhost' (using password: YES)")
Exception Location:	/usr/local/CyberCP/lib/python3.8/site-packages/MySQLdb/connections.py in __init__, line 179
Python Executable:	/usr/local/CyberCP/bin/python
Python Version:	3.8.10
Python Path:	
['',
 '/usr/local/CyberCP/bin',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP/lib/python38.zip',
 '/usr/local/CyberCP/lib/python3.8',
 '/usr/local/CyberCP/lib/python3.8/lib-dynload',
 '/usr/lib/python3.8',
 '/usr/local/CyberCP/lib/python3.8/site-packages',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP',
 '/usr/local/CyberCP']

What i tried to do:

https://community.cyberpanel.net/t/access-denied-for-user-cyberpanel-localhost-using-password-yes/14485/14

https://community.cyberpanel.net/t/cant-login-to-cyberpanel-access-denied-for-user/14625/3

But no solution worked. Help, please! :sweat_smile:

Can you please tell me about changes you made?

Hello shoaibkk, thanks for the help.

Before the problem occurred, I had done absolutely nothing. All of the sites on this server suddenly appeared with a problem connecting to the database.

I tried to connect with the Cyberpanel admin (:8090) and the connection error (500) appeared. I activated debug mode and saw the errors reported in the previous comment.

I restarted the server and nothing happened. I reinstalled and updated Cyberpanel to the latest version and nothing happened either.

Resetting the root and cyberpanel password and then updating it /usr/local/CyberCP/CyberCP/settings.py and
/etc/cyberpanel/mysql_password will fix it.

If it then gives database cyberpanel not found, check manually if it doesn’t exist. If it doesn’t, you can find a script to take that of it here on forum, but only after password is fixed.

Both links you posted show no correct way of reseting the password.

Hello tmoore, thank you for your help.

I made the password changes in the following files:

/etc/cyberpanel/mysqlPassword
mysql

/usr/local/CyberCP/CyberCP/settings.py
settings

/etc/postfix/mysql-virtual_domains.cf
virtual_domains

I rebooted the server, but the problem persists.

I checked the databases present in MariaDB, and there really isn’t one called cyberpanel.
mariadb-01

Is this database (cyberpanel) not created automatically when installing CyberPanel?

Thanks

Yes, cyberpanel stores the domains, email account, dns and such there.

You’re not the first person to who that happened recently, it’s really weird, I am not aware that cyberpanel got an update, at least I didnt check it yet, but something is really hapenning.

You can use the script I posted to restore the cyberpanel, but, you need to manually recreated the information regarding the websites, emails, etc.

I’ve seen other recent and similar calls here on the forum.

In my case it was a CP installation with more than a year of use, without falling. I didn’t make changes or updates on the server or on the CP.

Suddenly the sites went down, indicating a problem with the connection to the database. When trying to access CyberPanel, it is also down (500 error).

All site files remain on the server. But all databases disappear (Sites and CP).

I saw your post to recreate the CP database, but it didn’t work either.



Thank you for your help tmoore

Run this manually first:
CREATE DATABASE cyberpanel;

Then run the script. Or manually download the sql from the GitHub and run it manually, need to edit it so it creates auto but not at pc.

Yeah, it’s been hapenning and that means something is really hapenning, too many occurences nearly at same time

If it doesnt work still, I can help you by anydesk tomorrow, around 14-20 utc

@Misera worked or need some help?

Unfortunately nothing worked, with each new attempt a new problem appeared. I decided to abandon the instance and set up a new one.

Is there any way to recover the databases of the sites that disappeared from this installation with problem? One of the sites has a corrupted database backup, I needed to try to recover.

Thanks for the help tmoore.