Accessing MySQL Access from different host

I was working in PHP and MySQL. My database interface is PHPMyAdmin. Everything was working fine and some issues came when I was trying to access my site from other computer in LAN. Later these issues were resolved, so I thought to share them.

Initially, when I tried to open The Site on another local computer, it didn’t open. Then I turned off the Firewall.
Now, I was able to access The Site but other permissions were also required (I was using Wamp). So, I edited the Apache settings and removed a line which was denying the other local computer to access The Site.

Next, issue faced after The Site’s home page open correctly was that the links which I was clicking were going to nowhere (actually they were showing http://localhost/path which means they were now going back to files on my local computer). Actually, in config file on the server computer $path was defined as localhost, so I changed it to local IP address of the server computer.

Next, I was trying to access database of server computer and files were on my local computer. When I tried something like http://localhost/foldername/index.php then in this file database connection was for the server computer in LAN and it was showing an error that can’t connect to your IP Address. For this, you need to open http://ipaddress_of_server_lan/phpmyadmin/. Here, go to privileges and add a user with Username as root, Host as your IP Address of local computer and then password (if any). Then in config or connection file on your local machine add your IP address as hostname.

After adding this, I was able to access MySQL database located on other server.

Leave a Comment