Dear programers,
i am new to mysql and webhosting.

i have one website script,i want to instal the same script to my two domain

names(for example: domain1.com and domain2.com)

i dont want to add this two domain like addon domain.
i have two different hosting for this two domains.

for domain1 i have instal the script,during the installation the script asked

the following:(i have filled the same below)

Host:Local host
Database name:xxx
User name:YYY
Password:ZZZ

the domain1 is working fine.

for domain2 i like to use the domain1 database(xxx)(it is in diff hosting)
1)i want to know how to use the same database for diff domains?

2)pls help me to fill the following for domain2,
Host:
Database name:
User name:
Password:

Regards,
john

In order to work, you need to allow the mysql username (and your host also must allow this) to connect from remote machine. In host, you need to provide the IP or the domain name e.g. domain1.com and rest of the parameters will remain same as you provided before.

There shouldn't be a problem there. Use the same connection details for both domains.

There shouldn't be a problem there. Use the same connection details for both domains.

Wrong, because DB

for domain2 i like to use the domain1 database(xxx)(it is in diff hosting)

John, you need to ask your provider (from the one with DB) if databases is enabled for external access.
If not ask if it is posible, many providers do it, many refuse it as they do not knnow how :)
Once external access enabled your provider should also give you details how to connect to DB, can be IP or URL string

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.