No connection could be made because the target mac

2019-01-08 00:46发布

问题:

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?

回答1:

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



回答2:

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



回答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';


回答4:

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

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



回答5:

Sometimes if you delete your temporary files in windows in

C:\Windows\Temp

and

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

it works.



回答6:

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



回答7:

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



回答8:

Go to

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

Delete all the files.It will work.



回答9:

Open xampp control panel and click on config in front of MySQL after that open my.ini file and replace 3306 to another port like 3307 in all file. it will change your MySQL port which was conflicting with another application.