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

More from same category