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]  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.