Access denied for user 'cyberpanel'@'localhost' (using password: YES)

Lets sum this up with one additional explanation to solve this problem:

  1. You need to update the password for cyberpanel user.

Extract your current database password from:

/etc/cyberpanel/mysqlPassword
  1. Use the password to login using below command:
mysql --host=127.0.0.1 --port=3307 -u root -p

Then:
3. Check if user cyberpanel exists:

SELECT user, host FROM mysql.user;

Example result:

±------------±---------------------+
| User | Host |
±------------±---------------------+
| | centos-79-64-minimal |
| | localhost |
| cyberpanel | localhost |
| mariadb.sys | localhost |
| mysql | localhost |
| root | localhost |
±------------±---------------------+
7 rows in set (0.001 sec)

If cyberpanel user don’t exist, create it:

CREATE USER 'cyberpanel'@'localhost' IDENTIFIED BY 'YourCyberpanelDatabaseUserpassword';
GRANT ALL privileges ON `cyberpanel`.* TO 'cyberpanel'@localhost IDENTIFIED BY 'YourCyberpanelDatabaseUserpassword';

This “cyberpanelUserPassword” you can find in :

/usr/local/CyberCP/CyberCP/settings.py (nano /usr/local/CyberCP/CyberCP/settings.py)

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'cyberpanel',
        'USER': 'cyberpanel',
        'PASSWORD': 'YourCyberpanelDatabaseUserpassword',
        'HOST': 'localhost',
        'PORT':''
    },
    'rootdb': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'mysql',
        'USER': 'root',
        'PASSWORD': 'YourRootMysqlPass',
        'HOST': 'localhost',
        'PORT': '',
    },
  1. To apply assigned permisions:
mysql> FLUSH PRIVILEGES;

I hope this solves everyone’s problems with this, and I documented it as I solve it for myself. Regards. :slight_smile: