简体   繁体   中英

Can two different sites running on same host, share same database for storage and retrieval?

I am building a personal site, for a blog I wish to use WordPress and for a wiki i will use wikia . Is it possible that i use the same database for storing articles from both frontends (WordPress and wiki). If yes can i some how populate articles from my wiki to the blog, under a specific category.

EDIT-- By two different sites I mean two different frontends, hosted at different subdomains.

At installation time, both WordPress and Wikka allow you to prefix their tables with different names to prevent naming collisions. So yes it is possible to allow both applications to share the same database.

We have plenty of customers on our shared hosting environment who do this without any issues.

In answer to your second question, you may be in for a bit of custom code to do that.

Why not, its possible, just take care from any tables names conflict between both tables, you may need to edit some tables names.

And about populating one from another, i think you will need to edit its code some how to let it understand the new tables.

A host will put multiple clients on the same database server, so yes.

If you control the database and the apps, then you could code them to "share info"

They can quite happily use the same database. Depending on the RDBMS you are using, you may want to create an additional Database or user instance for each site.

With SQL Server you can create an additional database, or you can add a schema for each site. for Oracle you can create a user specific to each site.

To return data from one place to another, simply build a view which is accessible to each schema. You will need to set privileges on the source database to do this, but that's pretty straightforward.

I'm not really sure what your aim is. Is your intention simply to share data between Wordpress and Wikia?

You should not store two unrelated schemas in one database. It's just asking for collisions. Both Wikia and Wordpress maintain their own schemas: they may name different functional database objects the same.

If you want to share data between the two databases, you can set up triggers and views to move data from one to the other without them being in the same database.

The short answer is YES.

However, you will need to watch out for database object naming conflicts.

Also, when you say 'two different sites' do you mean 2 different sites? Or just different 'frontends' within the same site? If it just different front apps running in the same website, then you will also have to make sure you won't have any configuration conflicts.

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