Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: virtualuman (---.funnyordie.com)
Date: July 12, 2016 09:14PM

Hello all, im looking for some assistance with my site showing the splash page but once clicking to access our forms i get the error: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.

Please help, running on server 2012r2 as a vm.

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: RiggsFolly (Moderator)
Date: July 12, 2016 09:42PM

Sounds like MYSQL is not running or you are connecting to a machine that does not have MYSQL

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: virtualuman (---.funnyordie.com)
Date: July 12, 2016 11:39PM

I was able to repair the mysql service by completing the following:
Edit \wamp\bin\mysql\mysql5.6.17\my.ini Find the section marker [wampmysqld] and change it to [wampmysqld64]

Save my.ini
Restart WAMPServer

However the following link still will not work after trying to login:
[localhost]

error: SQL: [165] UPDATE ap_users SET login_attempt_date = NULL, login_attempt_count = 0 WHERE user_id = ? Params: 1 Key: Position #0: paramno=0 name=[0] "" is_param=1 param_type=2 Query Failed: SQLSTATE[HY000]: General error: 1881 Operation not allowed when innodb_forced_recovery > 0.

Please help! Thank you in advance!

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: RiggsFolly (Moderator)
Date: July 13, 2016 01:05AM

This is the clue

Operation not allowed when innodb_forced_recovery > 0

Error messages are there to be read, understood and acted upon

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 2 time(s). Last edit at 07/13/2016 01:06AM by RiggsFolly.

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: virtualuman (---.funnyordie.com)
Date: July 13, 2016 08:00PM

Right.. can you assist in resolving this problem? Otherwise I will have to resort to using a google form.

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: virtualuman (---.funnyordie.com)
Date: July 13, 2016 08:44PM

My forms are now visible however once submitting the forms I get another error:
I think I'm 1 step closer to google forms..

SQL: [475] INSERT INTO `ap_form_10996_review` (`element_1_1`,`element_1_2`,`element_4`,`element_5`,`element_6`,`element_7`,`element_8`,`element_9`,`element_14`,`element_34`,`element_35_1`,`element_35_2`,`element_36`,`element_38`,`ip_address`,`date_created`,`session_id`) VALUES (:element_1_1,:element_1_2,:element_4,:element_5,:element_6,:element_7,:element_8,:element_9,:element_14,:element_34,:element_35_1,:element_35_2,:element_36,:element_38,:ip_address,:date_created,:session_id); Params: 17 Key: Name: [12] :element_1_1 paramno=-1 name=[12] ":element_1_1" is_param=1 param_type=2 Key: Name: [12] :element_1_2 paramno=-1 name=[12] ":element_1_2" is_param=1 param_type=2 Key: Name: [10] :element_4 paramno=-1 name=[10] ":element_4" is_param=1 param_type=2 Key: Name: [10] :element_5 paramno=-1 name=[10] ":element_5" is_param=1 param_type=2 Key: Name: [10] :element_6 paramno=-1 name=[10] ":element_6" is_param=1 param_type=2 Key: Name: [10] :element_7 paramno=-1 name=[10] ":element_7" is_param=1 param_type=2 Key: Name: [10] :element_8 paramno=-1 name=[10] ":element_8" is_param=1 param_type=2 Key: Name: [10] :element_9 paramno=-1 name=[10] ":element_9" is_param=1 param_type=2 Key: Name: [11] :element_14 paramno=-1 name=[11] ":element_14" is_param=1 param_type=2 Key: Name: [11] :element_34 paramno=-1 name=[11] ":element_34" is_param=1 param_type=2 Key: Name: [13] :element_35_1 paramno=-1 name=[13] ":element_35_1" is_param=1 param_type=2 Key: Name: [13] :element_35_2 paramno=-1 name=[13] ":element_35_2" is_param=1 param_type=2 Key: Name: [11] :element_36 paramno=-1 name=[11] ":element_36" is_param=1 param_type=2 Key: Name: [11] :element_38 paramno=-1 name=[11] ":element_38" is_param=1 param_type=2 Key: Name: [11] :ip_address paramno=-1 name=[11] ":ip_address" is_param=1 param_type=2 Key: Name: [13] :date_created paramno=-1 name=[13] ":date_created" is_param=1 param_type=2 Key: Name: [11] :session_id paramno=-1 name=[11] ":session_id" is_param=1 param_type=2 Query Failed: SQLSTATE[HY000]: General error: 1881 Operation not allowed when innodb_forced_recovery > 0.

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: Otomatic (Moderator)
Date: July 13, 2016 09:29PM

Hi,

> I get another error:
NO, it is not ANOTHER error, it's the SAME error.
As already written RiggsFolly: READ error messages
> Operation not allowed when innodb_forced_recovery > 0
> Error messages are there to be read, understood and acted upon

SO, SAME ERROR
Operation not allowed when innodb_forced_recovery > 0.

You changed the setup file of MySQL my.ini by addin the directive :
innodb_forced_recovery=x
with x greater than 0.

This directive DOES NOT EXIST after installation of Wampserver.

You have created yourself this error and you do not even remember that you did.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: virtualuman (---.funnyordie.com)
Date: July 13, 2016 10:00PM

This is the same error, and I created it? Ok, nice assumptions!

This machine was working, and then it wasn't working randomly, w/ no changes to the server. I followed a forum article to get the mysql working again (my fault, ok!) Website is now displaying the page and the forms but doesn't do anything else..

I have researched the error, and it seems it could be a few different problems. Good luck to others who continue to use and implement this and then need assistance. I am unable to figure this out and apparently no one can assist.

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: Otomatic (Moderator)
Date: July 13, 2016 10:16PM

Remove the directive in the my.ini file.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: virtualuman (---.funnyordie.com)
Date: July 13, 2016 10:30PM

Please excuse my obvious gross negligent ignorance, How do I remove the directive? There are no other similar forum posts, who can I pay here for the answer.. ?

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: Otomatic (Moderator)
Date: July 13, 2016 10:34PM

Edit the my.ini file and delete the line

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: RiggsFolly (Moderator)
Date: July 13, 2016 11:45PM

Please listen to what is being said.

Edit the my.ini file

left click wampmanager icon -> MYSQL -> my.ini

In there you will find a parameter something like this

innodb_forced_recovery = 3

This line was ADDED BY YOU. It does not exist in WAMPServer unless added by a user

Delete this line, save the my.ini file

Then do a restart al services

left click wampmanager -> Restart all Services

Then try you app again.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: virtualuman (---.funnyordie.com)
Date: July 14, 2016 12:38AM

Hey! That worked! Thank you so much! I appreciate your time and assistance! I can now cancel the ugly google form I was about to use.

This line was not added by me or anyone with access to this file, I know because I / we have no clue what would go in here or what this specific line means.

What else could have caused this line, and the mysql line to have changed? I only ever log in to do MS updates, no one else ever logs in to this server or messes with the WAMP services.

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: RiggsFolly (Moderator)
Date: July 14, 2016 01:07AM

Can I bring your attention to one of your earlier comments

Quote

I followed a forum article to get the mysql working again


I dont know if you ever watched a TV program called `House` about a Diagnostition whose basic premice was
All patients lie all the time!

Well the same works for users. Have you ever heard a user admit that they did something really dumb to break the system. No me neither, but they do dont they!

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 2 time(s). Last edit at 07/14/2016 01:09AM by RiggsFolly.

Options: ReplyQuote
Re: Error connecting to the database: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Posted by: Otomatic (Moderator)
Date: July 14, 2016 10:31AM

Hi,

> This line was not added by me or anyone with access to this file...
Spontaneous generation of a directive in a my.ini file, I do not know.
No installation procedures of Wampserver between version 2.5.0 and 3.0.5 includes this line.
None of all MySQL addons include this line.

Again, and yet it is not for lack of repeat without stopping, we must fully READ error messages; almost always the solution is in the error message.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.