VestaCP “Error: connection failed” when making a database

I ran into this error with a fresh install of Vesta on a VPS.
The user was unable to create a database, due to this “Error: connection failed.”
At the command prompt, I attempted to connect to mysql with the command:

mysql -u root -p

It returned the error:

SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

I fixed this problem by modifying /etc/mysql/my.cnf, commenting out the line under mysql-client:


I was then, after restarting mysql service, to connect from the command line and Vesta was able to make databases.

Leave a Reply

Your email address will not be published. Required fields are marked *