Sporadic "access denied" on Trellis Multisite

I started out a project yesterday with a Trellis/Bedrock-based multisite. Vagrant up worked just fine and the site works for a while.

But after some random amount of time(a few minutes) it returns:

Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'devuser'@'localhost' (using password: YES) in /srv/www/sitename.com/current/web/wp/wp-includes/wp-db.php on line 1443

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /srv/www/sitename.com/current/web/wp/wp-includes/wp-db.php on line 1473

Warning: mysql_connect(): Access denied for user 'devuser'@'localhost' (using password: YES) in /srv/www/sitename.com/current/web/wp/wp-includes/wp-db.php on line 1473

Checking the logs gives something like this whatever url you try to access(front end/admin doesn’t matter):

2015/09/03 08:53:21 [error] 29655#0: *231 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined index: jvcf7_highlight_error_field in /srv/www/sitename.com/current/web/app/plugins/jquery-validation-for-contact-form-7/plugin_interface.php on line 39" while reading response header from upstream, client: 192.168.90.1, server: sitename.dev, request: "GET /wp/wp-admin/options-general.php?page=jquery-validation-for-contact-form-7%2Fplugin_interface.php&hidemsg=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-wordpress.sock:", host: "sitename.dev", referrer: "http://sitename.dev/wp/wp-admin/"

The wierd thing is that after some time it starts working again, seems really random.

No other errors or things that I could think of to fix this issue. Tried checking for solutions in:

https://discourse.roots.io/t/error-establishing-a-database-connection/3818

Also checked that there’s no manual entries for the urls in my host machines /etc/hosts-file.

Anyone having a clue on how to fix this? Would be really appreciated! :smile:

Second error notice is unrelated to db connection issues - are you seeing any other errors in your logs?

Do you get the errors if you disable all plugins?

1 Like

The problem lied inside one of the plugins, that used “mysql_connect” instead of WPDB. :frowning:

Didn’t seem like it at first but after a while of not having the plugin activated the problem didn’t show up anymore. Guessing it was the microcache that I had activated. :smile:

Thank you for your answer and for taking your time alanc!