Question

I am using XAMPP to create php projects. My system is: name=con7 and local ip=192.168.1.20 Another system is: name=con12 and local ip=19.168.1.10

I want to connect to a database in con12 from con7.

I read that we need to provide access permission for the host(ip) which is trying to connect from a different machine like the Access Host in cPanel->databases (the control panel for linux hostings).

I have access to that system as that person(con7) does the data entry and me the manipulation. some thing like that.

So how to do this?

Was it helpful?

Solution

In order to connect to a remote database you have to make sure:

  • The mysql-server has to listen on a public interface (e.g. eth0) in order to be accessable via lan. This can be checked via telnet on port 3306 (default mysql port)
  • The mysql-user must be allowed to connect at least from 192.168.1.20 or % (i.e. all hosts)
  • The mysql-user must have read (+write) permissions for the database

Do you want to run an PHP-script adding the correct credentials in mysql_connect() should suffice. If you want to use your local phpmyadmin to work with the database you have to add the database in the phpmyadmin-config.

Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top