Unable to Access CyberPanel and WordPress - Database Connection Issues

Hello,

I am currently facing issues with accessing both CyberPanel and WordPress on my server. After performing some troubleshooting and configuration changes, I encountered different errors that I need help resolving. Below is a detailed account of the steps I took and the current state of the system.

Background:

  1. Initial Issue:
  • CyberPanel and WordPress were initially inaccessible due to database connection issues.
  • The error for CyberPanel was: OperationalError at / (2002, "Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)").
  • The error for WordPress was: Error establishing a database connection.
  1. Steps Taken:
  • Verified MariaDB configuration files (/etc/mysql/my.cnf and /etc/mysql/mariadb.conf.d/50-server.cnf) to ensure correct settings.
  • Checked the MariaDB service status and socket file, which are now correctly created and active.

Current Issues:

  1. CyberPanel:
  • The error has changed to: ProgrammingError at / (1146, "Table 'cyberpanel.loginSystem_administrator' doesn't exist").
  • It appears that some tables might be missing or the database might be corrupted.
  1. WordPress:
  • The error remains the same: Error establishing a database connection.
  • Ensured correct database credentials in wp-config.php and verified the presence of the MariaDB socket file.
  • Note: The WordPress websites on the server display posts, images, and data correctly, but the WordPress admin dashboard shows the Error establishing a database connection error.

Details:

  1. MariaDB Configuration Files:
  • /etc/mysql/my.cnf:
[mysqld]
user                    = mysql
pid-file                = /run/mysqld/mysqld.pid
socket                  = /var/lib/mysql/mysql.sock
basedir                 = /usr
datadir                 = /var/lib/mysql
tmpdir                  = /tmp
bind-address            = 0.0.0.0
log-error               = /var/log/mysql/error.log

# Additional recommended settings for InnoDB
innodb_buffer_pool_size = 128M
innodb_log_file_size    = 48M
innodb_file_per_table   = 1

[client]
port=3306
socket=/var/lib/mysql/mysql.sock
  • /etc/mysql/mariadb.conf.d/50-server.cnf:
[server]
[mysqld]
user                    = mysql
pid-file                = /run/mysqld/mysqld.pid
socket                  = /var/lib/mysql/mysql.sock
basedir                 = /usr
datadir                 = /var/lib/mysql
tmpdir                  = /tmp
bind-address            = 0.0.0.0
log-error               = /var/log/mysql/error.log

# Additional recommended settings for InnoDB
innodb_buffer_pool_size = 128M
innodb_log_file_size    = 48M
innodb_file_per_table   = 1

# * Character sets
character-set-server    = utf8mb4
collation-server        = utf8mb4_general_ci

[mariadbd]
innodb_log_file_size=48M

[mariadb-11.1]
  1. Socket File Verification:
root@vmi1011023:~# ls -l /run/mysqld/
total 4
-rw-rw---- 1 mysql mysql 7 Jul  3 20:08 mysqld.pid
srwxrwxrwx 1 mysql mysql 0 Jul  3 20:08 mysqld.sock
  1. CyberPanel Database Configuration:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'cyberpanel',
        'USER': 'cyberpanel',
        'PASSWORD': 'Dzkcdkmf2GDE2',
        'HOST': 'localhost',
        'PORT':''
    },
    'rootdb': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'mysql',
        'USER': 'root',
        'PASSWORD': 'IiN5iBgEQhlL2q',
        'HOST': 'localhost',
        'PORT': '',
    },
}

Request for Assistance:

I kindly request guidance on the following:

  1. How to restore or reinitialize the missing cyberpanel.loginSystem_administrator table.
  2. Ensuring that WordPress can connect to the database without errors.

Any help or suggestions would be greatly appreciated. Thank you in advance for your support.