Akif Hussain Sayyed
Akif Hussain Sayyed

Reputation: 596

Access denied when opening phpmyadmin

I am using WAMP and the icon of the wamp is green and localhost is opening but when I try to open phpmyadmin, it gives me access denied containing the below error message:

#2002 - No connection could be made because the target machine actively refused it.
The server is not responding (or the local server's socket is not correctly configured).

Can anyone help me?

Upvotes: 0

Views: 1443

Answers (3)

Rokonz Zaz
Rokonz Zaz

Reputation: 166

Yes, I have run MYSQL on port 3333, it will change the port inside of config.inc.php file.

$cfg['Servers'][$i]['host'] = '127.0.0.1' 

to   

$cfg['Servers'][$i]['host'] = '127.0.0.1:3333'

It works, Fine!

Thanks!

Upvotes: 0

Stanimir Stoyanov
Stanimir Stoyanov

Reputation: 1213

  1. Edit c:\windows\system32\drivers\etc\hosts:

  2. Delete everything from that file and add 127.0.0.1 localhost

  3. Reboot

Upvotes: 2

RiggsFolly
RiggsFolly

Reputation: 94642

If phpmyadmin launches using 127.0.0.1/phpmyadmin but not when you use localhost/phpmyadmin then the issue is probably related to IPV4 and IPV6.

Wndows OS's have both the IPV4 and IPV6 network stack available 127.0.0.1 being IPV4

Check your HOSTS file, you should have

127.0.0.1 localhost
::1  localhost

The ip address ::1 is the IPV6 equivalnet to 127.0.0.1 and of course localhost is a domainname.

The browser makes an arbitrary decision to use either IPV6 (::1) or IPV4 (127.0.0.1) when it sees localhost as the domainname, and it is failing because your browser is using the IPV6 network but the alias for phpMyAdmin has not been configured to allow access from ::1.

To cope with this you need to change the wamp\alias\phpmyadmin.conf file to tell apache that is it allowed to accept connections from either IPV4 or IPV6 networks like so

So edit wamp\alias\phpmyadmin.conf and

If you have Apache 2.2.x change

Allow from localhost

To

Allow from localhost 127.0.0.1 ::1

Or if you are using Apache 2.4.x use this parameter

Require from local

I assume you are probably using an older verison of WAMPServer which came with Apache 2.2.x as newer verions should already be configured to allow access from both networks, so the first option is probably what you want.

Upvotes: 0

Related Questions