0

Problem I'm facing an issue with my VPS running CloudPanel where I cannot add new databases due to MySQL root access being denied.

Environment

  • CloudPanel on VPS
  • MySQL Server
  • Hosting Provider: Hostinger

Error Message Access denied for user 'root'@'localhost'

Steps I've Tried

1. Attempted direct MySQL login:

mysql -u root -p Result: Access denied error, tried multiple password combinations including:

  • Root user password
  • Hostinger password
  • Default passwords like (12345, admin, root, etc..)
  • No password

2. Attempted MySQL safe mode:

sudo systemctl stop mysql

sudo mysqld_safe --skip-grant-tables &

Result: Error message: MySQL cannot start in safe mode because the required directory for the UNIX socket file does not exist.

3. Attempted to kill running processes:

sudo kill -9 <PID>

Result: No process found with specified PID

4. Created missing directory and set permissions:

sudo mkdir -p /var/run/mysqld

sudo chown -R mysql:mysql /var/run/mysqld

5. Restarted MySQL in safe mode and verified process:

sudo mysqld_safe --skip-grant-tables &

ps aux | grep mysql

Result: Process found running

6. Attempted passwordless root login:

mysql -u root Result: Still encountering access denied error

Additional Context

  • Hostinger support was unable to resolve the issue
  • CloudPanel tutorials show database creation through UI without command-line intervention
  • Suspect issue might be related to CloudPanel's default MySQL user restrictions

*I have reached out to Hostinger support, but they were unable to provide a solution beyond what I have already attempted. Additionally, all the YouTube tutorials on setting up and creating a database in CloudPanel show a straightforward process with no access issues, as everything can be done directly from the UI without requiring any command-line input.

I suspect it might be related to CloudPanel’s default MySQL user restrictions or authentication settings, but I’m not sure how to proceed. Has anyone encountered a similar issue or knows how to regain root access?*

2 Answers 2

0

in cloudpanel command Clpctl db: You can see the master credentials This is the password that you can enter MySQL So you need to change the password to be exactly like the cloudpanel in mysql .

0

You can get the root password this way, and it's on the cloudpanel tutorial https://www.cloudpanel.io/docs/v2/frontend-area/databases/ :

  1. Login to your server via SSH and elevate to root user:
sudo su -
  1. Run the CloudPanel command to display the MariaDB master credentials:
clpctl db:show:master-credentials

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.