Getting error for db query when nginx and db on different servers?

My client was having one old server with apache, mysql, php. We moved server to new location and I installed easy engine on it. we have separate machine for db server and http (nginx)+php server. All other things going good. Issue is with moodle portal.

I am getting error while running moodle on new server. Below is error coming at runtime for moodle, while attempting quiz, creating new course. I googled for suggestions but nothing worked. I think there is something which blocking query request. On old server it was working really fine. I dont know whether it is issue with nginx or with separate db server.

1… with moodle

2015/04/27 09:04:34 [error] 28691#0: *5473 FastCGI sent in stderr: "PHP message: Database transaction aborted automatically in /var/www/" while reading response header from upstream, client:, server:, request: "POST /elearning/course/togglecompletion.php HTTP/1.1", upstream: "fastcgi://", host: "", referrer: ""

2…with wordpress… i have db prefix for wordpress is ip_

Apr 27, 07:59:48	WordPress database error Table 'example_com.wp_posts' doesn't exist for query SELECT count(*) AS count FROM wp_posts WHERE `post_type` = 'wpcf7_contact_form' made by require_once('wp-admin/admin.php'), require('wp-admin/menu.php'), require_once('wp-admin/includes/menu.php'), do_action('admin_menu'), call_user_func_array, postaffiliatepro->addPrimaryConfigMenu, postaffiliatepro_Util_ContactForm7Helper::formsExists, postaffiliatepro_Util_ContactForm7Helper::formsExistsNew, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query

I converted all tables to MyISAM for moodle and issue which I was facing with moodle is fixed now. Quiz started to work.

So issue which giving error number 1 is fixed now.

Please help somebody to fix issue number 2 with WordPress.

It looks like you’re using W3T cache plugin for DB caching with your WP install, have you tried to deactivate it and see if you receive same error?

Database caching is already deactivated, but now I forgot about that error.