How to solve Vestacp/Hestiacp localhost connection error when adding new database

How to solve Vestacp/Hestiacp localhost connection error when adding new database

This article explains how to solve the prolem in the VestaCP or HestiaCP management environment when you have modified the root password of the database server and can't add databases to a user anymore.

We are using HestiaCP (a VestaCP fork) for our Ubuntu intranet test and development server. But recently I had a problem adding new databases to a user for it gave me the error:

How to solve this?

I got this error because I changed the password of the root user outside the HestiaCP control panel. Which is not wise which I figured out after some research.

To repair this you have to check the following:

I use nano but you could also use vi for this. In this command below you see hestia, but if you use VestCP then change this to vesta

sudo nano /usr/local/conf/hestia/my.cnf

In this file you see a password. Note that down somewhere, but DON'T change this!

Next you have to check this file:

sudo nano /root/.my.cnf

There is also a password in this file. This password should be the same as the one you have written down a moment ago. If it isn't the same, then change it in this file and save it.

Don't do crazy stuff like change it to a complete different value in both files, first make it work again

Now we have to change the root password in the mysql.

To connect to the database server you use the password that you have changed outside the HestiaCP/VestaCP management environment. I hope you remembered it.

Once you have access to the MySQL server you change the password to the password you have written down in the earlier step.

ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourwrittendownpassword';

Sample output:

The passwords on all 3 places mentioned have now the same value as the one you have written down in the first step.

You could restart the mysql database within VestaCP/HestiaCP and try again to add a database to a user.

Add a new database

6 months ago
Couldn't run this command
sudo nano /usr/local/conf/hestia/my.cnf

and also i haven't changed any root password change.

Issue is, i am not able to create database in Hestia control panel. Can you please help regarding this.
6 months ago
Do you mean that nano is not available at all? Or that the file / is not there?
If nano is not there you have to install it (sudo apt-get install nano) or use another editor like f.e. vi.

Just let me know what exactly means "Couldn't run this command"
1 month ago
getting an error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED BY 'xxxxxxxx'' at line 1 when trying to run the ALTER USER command. Any idea why?

your email address will not be published. required fields are marked *

More from same category