views:

40

answers:

1

Hi, 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?

A: 

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.

stefan
Where do we grant the permission.In which file?or... from the command line?when i tried telnet con12 3306 i got the following reply[[con7 is not allowed to connect to this MYSQL server]]So it is clear that any other ip is denied.Is there any interface to grant permission?
Jayapal Chandran