3

I'm new in web development. I'm requesting help from all of you. My problem is:

I installed WAMP server in my desktop computer. My desktop computer has a static LAN IP (192.168.0.101).

I'm able to access WAMP server homepage from my other computers connected to the same network by using the LAN IP (192.168.0.101). But while I was trying to access phpMyAdmin from other computer it says:

Forbidden. You don't have permission to access/phpmyadmin/ on this server. Apache/2.4.9(Win64) PHP/5.5.12 Server at 192.168.0.101 Port 80.

I also tried to connect to the MySQL database running on my desktop computer using cmd in other computer by the following code, mysql -h 192.168.0.101 -u root -p (there is no password for root user).

Please help me how could I be able to access phpMyAdmin and MySQL database from other computer connected to the same network.

4

WAMPServer is primarily designed for use on a single machine i.e. a developer writing and testing code locally on that PC.

So to protect the beginner from his/her self the Apache & MySQL configuration by default is setup so no access can be made to the Apache or MySQL server form anywhere but the PC running Apache and MySQL.

When changing this configuration great care should be taken to only allow access that you intend and not global access. So be VERY CAREFUL with any help/tutorial that suggest adding Allow from all or Require all granted as they either dont really know what they are doing or the help is based on giving access to the site to the whole internet.

To allow access to phpMyAdmin you need to change the Alias configuration for phpMyAdmin, so edit wamp\alias\phpmyadmin.conf and add an instruction to allow access from any ip address on your internal network like so :-

Alias /phpmyadmin "d:/wamp/apps/phpmyadmin4.1.14/"

<Directory "d:/wamp/apps/phpmyadmin4.1.14/">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride all
  <IfDefine APACHE24>
    Require local
-->     Require ip 192.168.0
  </IfDefine>
  <IfDefine !APACHE24>
    Order Deny,Allow
      Deny from all
      Allow from localhost ::1 127.0.0.1
-->     Allow from 192.168.0
    </IfDefine>
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360
</Directory>

If you actually want to access MySQL via the mysql.exe processor and other tools like it from another IP address you have basically the same problem.

MySQL user account are made up of 2 parts, a UserId and a Host. The Host part tells MySQL where this userid is allowed to connect from. If you look using phpMyAdmin at the user accounts that are pre-created in MySQL you will see that the Host part of all the account is either 127.0.0.1 or localhost or ::1 all of which equate to The PC running MySQL. Again for the security of the beginner no access allowed from outside the PC running MySQL.

So to use mysql.exe etc, I suggest you create a new MySQL User Account, lets say MAKhan with a Host of 192.168.0 AND OF COURSE A PASSWORD. That account will them be allowed to login to MySQL from any ip on your local network. You will of course have to give rights to this new account so that it can access some or all of the databases on the MySQL server.

|improve this answer|||||
  • Learned a lot from your answer RigsFolly, thanks a lot. But I'm not clear about "--> Require ip 192.168.0" and "--> Allow from 192.168.0". As per I know IPs are build of 4 parts, if so then is it not required to add any digits or any wildcards (E.G. 192.168.0.101 or 192.168.0.%) after the IP you mentioned above. – Al-Amin Khan Oct 15 '14 at 8:40
  • Allow from ... is Apache 2.2.x syntax. Require ip ... is Apache 2.4.x syntax. If you use just the first 3 quartiles you are basically saying allow any ip in that subnet. You can even use just the first 2 quartiles if that makes sense in your network. No wildcard is required! – RiggsFolly Oct 15 '14 at 9:00
1

If you are access PHPMyAdmin from another LAN location then the Apache server needs to be able and willing to accept connections from other than localhost. This will probably mean simply ensuring that the port (80 by default) is open to the LAN and that Apache is likewise willing to serve to remote addresses (which I would expect it to unless you have a very odd set up). That's a WAMP issue.

You can also make remote MySQL connections to your DB directly but again you need the right port(s) open and the MySQL user needs to have remote host access enabled. That's a MySQL issue.

Without knowing what Firewall you are using it is hard to advise the best way to open ports in your particular case.

|improve this answer|||||
  • I'm using windows firewall. If you kindly describe in detail about the issues you mentioned it would be a great favor for me. – Al-Amin Khan Oct 13 '14 at 2:02
  • I'm not intimately familiar with the windows firewall but if a short look at the UI and a Google on the subject leaves you still scratching your head then you might need to ask another question. Give it a go most firewalls are fairly self explanatory. – Matthew Brown aka Lord Matt Oct 13 '14 at 22:26
0

I haven't done it on windows, but I did it with mamp. I just had to allow the connection through the firewall. So open the ports got them or temporarily disable your firewall

|improve this answer|||||
-1

AS above mentioned Change in this file wamp\alias\phpmyadmin.conf

"Require local" Changed to => "Require all granted" "Deny from all" Changed to => "Deny from none" "Allow from localhost ::1 127.0.0.1" Changed to => "Allow from all"

Restart The Server Don't Change other things
Other Pc will Surely able to access the phpmyadmin Page

If you are not able to login then check from the mysql server root user host value in mysql-DB user table

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.