Cannot connect to MySQL
Posted by: Chrono741 (213.129.152.---)
Date: September 25, 2012 09:40PM

Hi, i have a problem.

When i open PHPMyAdmin there is #2002 error, and when i go on localhost/testmysql.php there is this :

( ! ) Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in C:\wamp\www\testmysql.php on line 2
Call Stack
# Time Memory Function Location
1 0.0005 246176 {main}( ) ..\testmysql.php:0
2 0.0005 247032 mysql_connect ( ) ..\testmysql.php:2
Could not connect to MySQL: No connection could be made because the target machine actively refused it.

My line 2 : "$link = mysql_connect('127.0.0.1','root','');" (i tried "localhost" )

PHP has no error in log, but:

Apache error log:

[Tue Sep 25 21:24:33.412990 2012] [:error] [pid 5136:tid 780] [client 127.0.0.1:49841] PHP Warning: mysql_connect(): No connection could be made because the target machine actively refused it.\r\n in C:\\wamp\\www\\testmysql.php on line 2
[Tue Sep 25 21:24:33.412990 2012] [:error] [pid 5136:tid 780] [client 127.0.0.1:49841] PHP Stack trace:
[Tue Sep 25 21:24:33.412990 2012] [:error] [pid 5136:tid 780] [client 127.0.0.1:49841] PHP 1. {main}() C:\\wamp\\www\\testmysql.php:0
[Tue Sep 25 21:24:33.412990 2012] [:error] [pid 5136:tid 780] [client 127.0.0.1:49841] PHP 2. mysql_connect() C:\\wamp\\www\\testmysql.php:2
[Tue Sep 25 21:29:23.767890 2012] [mpm_winnt:notice] [pid 4948:tid 388] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Tue Sep 25 21:29:25.795893 2012] [mpm_winnt:notice] [pid 5136:tid 280] AH00364: Child: All worker threads have exited.
[Tue Sep 25 21:29:25.811493 2012] [mpm_winnt:notice] [pid 4948:tid 388] AH00430: Parent: Child process exited successfully.
[Tue Sep 25 21:29:26.419894 2012] [mpm_winnt:notice] [pid 264:tid 388] AH00455: Apache/2.4.2 (Win64) PHP/5.4.3 configured -- resuming normal operations
[Tue Sep 25 21:29:26.419894 2012] [mpm_winnt:notice] [pid 264:tid 388] AH00456: Server built: May 13 2012 19:54:49
[Tue Sep 25 21:29:26.419894 2012] [core:notice] [pid 264:tid 388] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.2\\bin\\httpd.exe -d C:/wamp/bin/apache/apache2.4.2'
[Tue Sep 25 21:29:26.419894 2012] [mpm_winnt:notice] [pid 264:tid 388] AH00418: Parent: Created child process 1040
[Tue Sep 25 21:29:26.997095 2012] [mpm_winnt:notice] [pid 1040:tid 280] AH00354: Child: Starting 64 worker threads.


MySql error log:


120925 21:29:27 [Note] Plugin 'FEDERATED' is disabled.
120925 21:29:27 [Note] Plugin 'InnoDB' is disabled.
120925 21:29:27 [ERROR] wampmysqld: unknown option '--skip-locking'
120925 21:29:27 [ERROR] Aborting

120925 21:29:27 [Note] wampmysqld: Shutdown complete

I tried change port and disable firewall, nothing worked....


Sorry for my english :/

Options: ReplyQuote
Re: Cannot connect to MySQL
Posted by: RiggsFolly (---.as13285.net)
Date: September 26, 2012 10:28AM

Ok I think what is happpening here is that the MySQL error ( --skip-locking) is crashing your mysql server and therefore there is no database to respond to your connection request in the PHP code.

The last time I saw this --skip-locking problem was when there was an old my.ini file somewhere on the system.


Do a search for my.ini and also my.cnf, if you find either in any location OTHER THAN the c:\wamp...... folders delete them.

Options: ReplyQuote
Re: Cannot connect to MySQL
Posted by: Chrono741 (213.129.146.---)
Date: September 26, 2012 12:25PM

thank you very much !
there was old my.cnf in C:\
now it works fine, thanks smiling smiley

Options: ReplyQuote


Sorry, only registered users may post in this forum.