how to connect to database on another server

前端 未结 8 1168
孤独总比滥情好
孤独总比滥情好 2020-12-03 02:05

Could I have my php scripts on server A and connect to the MySQL database on server B?

If yes, how it would be done? Thanks in advance

相关标签:
8条回答
  • 2020-12-03 02:40

    Have a look here:

    http://us2.php.net/manual/en/function.mysql-connect.php

    You can either pass in the server hostname as an argument, or configure in php.ini.

    0 讨论(0)
  • 2020-12-03 02:50

    its simple all thise above techniques are quite complicated

    suppose you have database on server B and website on server A(say it has IP 192.234.12.1)

    on cpanel whitelist the IP of server B

    and create a new user having sufficient privileges in database (say this user is test)

    then create this user as test@192.234.12.1

    0 讨论(0)
提交回复
热议问题