GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Tech How To Share A DB Between Sites (https://gfy.com/showthread.php?t=1279265)

HairyChick 09-14-2017 06:43 PM

How To Share A DB Between Sites
 
I'm planning on a site that has a backend db. I registered a similar domain, too I want to build site A then clone it on site B.

The db needs to be shared on both sites so I can update A and B will update.

Design, post, backend db, everything needs to instantly updated. With amnesia I can't remember how it's done. Ideally, I'd like to update A then click a link in the backend to copy over all changes.

I'd rather not have to ftp over the changes, PHPmyadmin copy the db, etc. Simple and easy with nothing to remember but one click.

Doable? Extensive coding or not too time-consuming?

LouiseLloyd 09-14-2017 09:41 PM

Quote:

Originally Posted by PamWinterReturns (Post 22000045)
The db needs to be shared on both sites

Have both sites use the same db!?

freecartoonporn 09-15-2017 09:21 AM

set up one DB.

set up two sites using same DB.

HairyChick 09-15-2017 05:11 PM

Set up one db? Seems too simple. Build site A, then configure site B with same credentials as site A!?

If so, how will B update ?? Don't I need to manually tell A you update B?
? ?

Barry-xlovecam 09-15-2017 05:49 PM

If the domains are on the same server they can use the same database logins as localhost.
Alternatively, each domain could be a separate database user (sharing the same database).

Each database has users with grant privileges given (configured) by the database root.
root@localhost
Code:

mysql -u root -p
Enter password:*******

CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON `databasesprefix%`.* TO user@localhost IDENTIFIED BY 'password';

FLUSH PRIVILEGES;

A database user (MySQL) can have a difference user name and password than the UNIX (webroot user) -- they probably should.

You can allow database remote connections restricted only to authorized static IPs also.

Barry-xlovecam 09-15-2017 05:51 PM

Quote:

Originally Posted by PamWinterReturns (Post 22001383)
Set up one db? Seems too simple. Build site A, then configure site B with same credentials as site A!?

If so, how will B update ?? Don't I need to manually tell A you update B?
? ?

Depends on A and B's write privileges to the shared database.

TFCash 09-15-2017 06:41 PM

Pam -

you need to specify, are you talking about a custom script that is running the two sites, or are you using wordpress like all your other posts talk about ???

If it's a custom script, then they should be able to share the same database with a few code changes. If your talking about using wordpress for two domains from the same database, it can be done, but it's a lot more headaches than it's worth. Better to just have siteB feed off of siteA with a plugin like https://wordpress.org/plugins/feedwordpress/

:2 cents:

wankawonk 09-15-2017 06:58 PM

easy to do if you have tech skills but if you're fucking around with scripts that other people wrote and you don't understand how they work it's gonna be hard to figure out, and you probably won't find usable technical help on gfy

brandonstills 09-15-2017 07:20 PM

When you specify which database to use just specify the connection info to the database.

Typically connection info consists of:

- hostname or IP address (defaults to localhost usually)
- port (usually just leave at default)
- database name (you choose this during setup typically)
- username / password

Ferus 09-16-2017 12:00 AM

- Set the sites up individually
- have a developer build you a script that migrates the data from selected tabels in the database, to the new database
- Have a developer set up a script that replicates selected mediafolders (uploads and media)

Only migrate selected tabels (content related) and media/upload folders.

If you replicate eveything, it will be a pain to maintain in regards to uploads, updates and security

TACNet 09-17-2017 06:23 PM

Quote:

Originally Posted by PamWinterReturns (Post 22001383)
Set up one db? Seems too simple. Build site A, then configure site B with same credentials as site A!?

If so, how will B update ?? Don't I need to manually tell A you update B?
? ?

We been doing this for years. One DB server backend that updates multiple sites across multiple servers

Obviously all the sites need to connect to the db server which can be done using localhost (if everything is one one server) or you can grant access by IP address for a multi server environment

Then simply use a script (eg PHP, Perl etc) to produce your pages on-the-fly so any changes are instantly reflected accross all sites

If you have a high traffic page (eg your index page) then you may want to have a cron script update that page say once every hour rather than on-the-fly as it can overload the db server.


All times are GMT -7. The time now is 12:54 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc