1

I've installed XAMPP on my Windows XP. I started the XAMPP control panel and it shows apache and mysql are running.

When I check the status by going to localhost/xampp it shows:

mysql : deactivated

When I run php files that access the mysql database, it shows the following errors:

Warning: mysql_connect() [function.mysql-connect]: [2002] No connection could 
be made because the target machine actively refused it. (trying to connect 
via tcp://localhost:3306) in C:\xampp\htdocs\Elo_algorithm.php on 
line 18

I've been through the XAMPP troubleshooting page and FAQ but I don't understand what to do. The XAMPP control panel shows mysql is running, but xampp status shows: deactivated.

What is going on here?

2
  • 1
    Do you have any other mysql installation on your machine? Commented Nov 30, 2011 at 7:41
  • If the XAMPP control panel shows mysql being deactivated, start it. If it doesn't run, check out the MySQL log, this should be located in then \xampp\mysql\data` directory, its default name is mysql_error.log` . This should make visible why your MySQL isn't starting. Commented Nov 30, 2011 at 7:50

5 Answers 5

2

OK I got this issue resolved in my case, hopefully will help you too. Problem was system itself. If you run Vista, Win7, win8 you probably have permission issue. Simple go to XAMPP root and find mysql_start.bat and run it. Immediately after clicking your firewall will appear with message asking for permission. All you have to do is to allow permission (for private networks such a home or work network).

MySQL database ACTIVATED - and that's what matters ;)

I hope that helps to all of you who did not get an answer so far. Cheers!

Sign up to request clarification or add additional context in comments.

Comments

0

You should view in the xampp installation the file "\xampp\mysql\data\mysql_error.log".

This file contais the error log of MySQL and in it you can detect any problem like por in use.

For example, this lines of log show that the port 3306 (the mysql default) is used by another application and can't be accessed.

111130  8:39:56 [ERROR] Can't start server: Bind on TCP/IP port: No such file or directory
111130  8:39:56 [ERROR] Do you already have another mysqld server running on port: 3306 ?
111130  8:39:56 [ERROR] Aborting

If all in the MySQL is correct probably the problem is related to the driver in the php application. Currently PHP has two MySQL connector types, the "mysql" and the "mysqli", MySQL "mysql" connector, that use "mysql_" (the method that you are using to connect is mysql_connect) prefixed functions, is used for old MySQL 4 applications and when the MySQL 5.x if is in configured with the "old password" parameter. The "mysqli" is used for the new mysql 5.x versions and in php you must use "mysqli_" prefixed functions like "mysqli_connect.

The version used by the lastest versions of xampp is MySQL 5.5 and you require to used the mysqli connector.

Comments

0

Check whether the value of port variable in the "my.ini" file in your xampp mysql folder is 3306 or 8888

Comments

0

i was facing the same problem. I had to run setup-xampp.bat to make it working. By the way I came across a new WAMP stack called AMPPS. It looks quite easier than XAMP. You should try. http://www.ampps.com

Comments

0

I could not get XAMPP for Windows (1.7.4 Beta2--I know; ancient) to work on Windows 7 (32 bit) as the MySql would not "activate" or connect to Apache. Just by dumb luck I installed .NET Framework 4.6 for another application and suddenly--Whoopee! It started working!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.