简体   繁体   中英

xampp - connecting to a local database from another local machine inside a LAN

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?

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

  • The mysql-server has to listen on a public interface (eg 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 % (ie 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM