18

When I was trying to connect my phpmyadmin on my XAMPP, it gave an error:

#2002 - No connection could be made because the target machine actively refused it. 

Can any help me to resolve it?

jon snow
  • 3,062
  • 1
  • 19
  • 31
Srikanth Kolli
  • 892
  • 1
  • 8
  • 19
  • You can open your xampp with administrative right means Run as administrator and then start Apache after that run MySQL it works if you haven't any other issue.. – Sonpal singh Sengar Jul 23 '21 at 17:01

10 Answers10

21

Okay, so i tried all of the answers and none of them worked. If you are using different port than 3306 for MySQL you need to specify it in config.inc.php.

So since i was using port 3308, my solution was adding the following line in config.inc.php:

$cfg['Servers'][$i]['port'] = 3308;

add it right bellow the user, password or extension lines.

Celestial
  • 913
  • 1
  • 9
  • 17
10

Go to

C:\Users\YourUser\AppData\Local\Temp

Delete all the files.It will work.

8

Go to :

xampp/phpmyadmin/config.inc.php

open the file config.inc.php Go to line no:31

$cfg['Servers'][$i]['controluser'] = 'pma';

Change the line to :

$cfg['Servers'][$i]['controluser'] = 'root';

Restart your system.

Reference

Pradip Kharbuja
  • 3,442
  • 6
  • 29
  • 50
7

If your operating system is Windows 7:

  • go to control panel -> Administrative Tools -> Services
  • find mysql then right-click, click start

If your operating system is Linux (Ubuntu):

  • in terminal type this command: sudo /etc/init.d/mysql start

Good Luck

abe
  • 624
  • 8
  • 14
  • I get this error when I start mysql from services app. Windows could not start the mysql service on Local Computer. Error 1067: The process terminated unexpectedly. – Thompson Oct 24 '14 at 15:59
5

Please go to c:\xampp\tmp folder and delete all the files. It works for me may help you.

3

Please try changing connect_type in your config.inc.php from 'tcp' to 'http'. This file exists in the phpMyAdmin top level directory.

Existing line looks like this:

$cfg['Servers'][$i]['connect_type'] = 'tcp';

New line should be looking like this:

$cfg['Servers'][$i]['connect_type'] = 'http';
Raceimaztion
  • 9,494
  • 4
  • 26
  • 41
2

Assuming you're trying to connect to http://localhost/phpmyadmin.

From XAMPP control panel start both the Apache module and the MySQL module.

2

Instead of localhost, type this in your address bar localhost:<PORT> (e.g. localhost:88)

Eugene Obrezkov
  • 2,910
  • 2
  • 17
  • 34
1

Sometimes if you delete your temporary files in windows in

C:\Windows\Temp

and

C:\Users\YourUser\AppData\Local\Temp

it works.

Natalie
  • 186
  • 1
  • 1
  • 9
  • Thanks. This worked for me. I have two installs of xampp (one with php 5.6 and the other 7.1) and the error was shown to me after changing from one phpmyadmin (xampp php 7.1) to the other (xampp php5). After clearing the %SystemRoot%\Temp folder, all were good again. – Cubakos Mar 17 '18 at 17:06
0

Check if your MySql service is running or not.

You can check it by searching Services in Start and then check the status of mysql80 service. If your service is not running then start service by right clicking on it and then Start.

Or you can use CMD.

Open Command Prompt as administrator and then run net start mysql80.

Jake Peralta
  • 408
  • 3
  • 9