Error establishing a database connection on vagrant

I’m getting repeatedly this error while working locally with Vagrant. It started to happen a week ago and I can’t find what is causing this. If I do vagrant reload everything start working again, but after a while this error appears again causing me big troubles in my daily work process. I also updated to the latest box and did vagrant reload --provision, but nothing seems to prevent this from happening.

Warning: mysqli_real_connect(): (HY000/2002): Connection refused in /srv/www/############/current/web/wp/wp-includes/wp-db.php on line 1452
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /srv/www/############/current/web/wp/wp-includes/wp-db.php on line 1482
Warning: mysql_connect(): Connection refused in /srv/www/############/current/web/wp/wp-includes/wp-db.php on line 1482

Any clue of what might be going on will be really appreciated.

See this thread: Sporadic "access denied" on Trellis Multisite

It’s probably an error with a plugin.

Thanks for your quick answer and suggestion! I will try to identify this plugin (if that turns to be the problem) and write here for updates.

I have found that just passing --url=examplesite.dev fixes this error for me any allows the command to work