Article directory
Some SEO professionals have installed VestaCP :
- He added 2 databases and 2 sites.
- Everything looks business as usual today.
Error problem with VestaCP
But today when he tried to add the third database, he received the error message: "Error: connection to localhost failed "...

he tries to change/usr/local/vesta/conf/mysql.conf password in the file.
- Existing database is not running, still cannot add new database.
When restarting the server, you may encounter the following error: Error: connection to localhost failed, connection to VestaCP failed...
An administrator of an e-commerce website set up a MySQL database , but encountered the same error when trying to connect to the website :
- After doing some research, noticed that the password value was in
/root/.my.cnfThere is no change in. - But when
/usr/local/vesta/conf/mysql.confThe correct password is displayed, and the content submitted through the panel is sufficient.
Solution
1) Change the password in the MySQL default file ▼
vi /usr/local/vesta/conf/mysql.conf
- Change the previous password to your existing password.
2) Restart the MySQL database ▼
service mariadb restart
- Or log in to VestaCP Panel → Server → Restart MySQL.
Extended reading:
Hopefully, the article "Solving VestaCP Error: connection to localhost failed" shared on Chen Weiliang's blog ( https://www.chenweiliang.com/ ) will be helpful to you.
Feel free to share this article's link: https://www.chenweiliang.com/cwl-1452.html



