|
|
|
|
![]() ![]() |
![]() Group: Members
Posts: 4 Joined: 4-October 06 Member No.: 31,064 |
Post
#1
Oct 4 2006, 06:07 PM
How do you combine multiple mysql databases into one database? I was thinking thta soem servers restrict you to one to five mysql databases. If I have a dynamic part of a table on my site, I would use one database for that. For every table of dynamic information, I use one database. Can I streamline what I am doing and combine all of my databases into one? I could make multipple tables in the same database. Would that work? thanks |
![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 95 Joined: 4-October 06 Member No.: 31,075 |
Post
#2
Oct 4 2006, 06:23 PM
The most common method, and many well coded apps support this, is table prefixes. So let's say you have xoops. All the tables would be xoops_news, xoops_conent, xoops_banners, etc. Then let's say you want to have Promisance game engine. Then those tables could be prom1_game, prom1_news. Let's say you want a second Promisance game engine: Prom2_game, prom2_news let's say you want to include phpbb... phpbb_news, phpbb_members so on and so forth. I used to have to do this back in the day when you only got 1 MySQL database with your hosting accounts. |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [MODERATOR]
Posts: 4,908 Joined: 24-July 05 From: Linux, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() myCENT:6.20 |
Post
#3
Oct 4 2006, 06:28 PM
Exactly. The trouble with that is the need to re-code your queries and such in all of your scripts, but it is do-able, yes. It would be preferred to have seperate databases for each "function" to make the code portable and to allow for "modularization", but if the larger restriction is the number of databases allowed on the account, then it would win the battle. SQLite DBMS is available through php. Might want to check to see if that could be used to augment the D/b count. MySql and SQLite are 'similar', but not the same. Have a look at the php Manual for information about SQLite. Or are there some uses that might be able to use 'flat-files' instead of Databases? Using a flat-file to store information which doesn't change too often or isn't used much might be one way to reduce your D/b count. As to the 'how-to-do-this' aspect of combining the data tables into a single database, have a look at the phpadmin software. It does amazing stuff. |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED]
Posts: 936 Joined: 14-April 05 From: West Chester, PA Member No.: 5,636 |
Post
#4
Oct 5 2006, 04:10 PM
That is the only way to do it and if you wrote the code correctly to begin with, you would have made a new table for each new set of data you have rather than a new database. A database should be the same for everysite so that if you ever want to export it or even distribute it as a template, all the other person has to do is import the 1 table and everything will work. Plus it keeps your databases clean and easy to use if you host more than one site on the same account and both use a database. Then you dont have to worry about name conflicts and finding the right tables. All you do is go to the correct db and then change the right table.
|
![]() ![]() |
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
13 | chinfo | 8,705 | 2nd August 2004 - 03:12 AM Last post by: X3r0X |
|||
![]() |
3 | chalawanonline | 6,269 | 2nd August 2004 - 02:34 PM Last post by: Spectre |
|||
![]() |
2 | threepach | 2,098 | 19th February 2008 - 08:30 PM Last post by: threepach |
|||
![]() |
7 | Raptrex | 13,188 | 27th August 2004 - 11:16 PM Last post by: Spectre |
|||
![]() |
4 | NuHoaXuLa | 6,230 | 29th August 2004 - 03:12 AM Last post by: NuHoaXuLa |
|||
![]() |
11 | Triple X | 6,339 | 5th September 2004 - 02:33 AM Last post by: Triple X |
|||
![]() |
4 | Schweden | 4,967 | 8th September 2004 - 09:40 AM Last post by: Schweden |
|||
![]() |
2 | Too_Hot | 3,611 | 16th September 2004 - 05:25 PM Last post by: serverph |
|||
![]() |
2 | BoSZ | 4,240 | 17th September 2004 - 09:09 PM Last post by: BoSZ |
|||
![]() |
7 | XtremeGamer99 | 6,829 | 18th December 2008 - 10:13 PM Last post by: minimcmonkey |
|||
![]() |
8 | guangdian | 5,594 | 2nd October 2004 - 05:03 AM Last post by: football123213 |
|||
![]() |
2 | Raptrex | 3,384 | 1st October 2004 - 05:53 AM Last post by: serverph |
|||
![]() |
5 | JaVe | 4,825 | 25th December 2008 - 10:11 AM Last post by: xpress |
|||
![]() |
4 | brandrocker | 595 | 27th December 2008 - 12:16 PM Last post by: OpaQue |
|||
![]() |
3 | outwarsecrets | 4,740 | 10th October 2004 - 08:04 AM Last post by: whatknows |
|||
|
Open Discussion | Time is now: 8th November 2009 - 04:59 PM |
Web Hosting Powered by ComputingHost.com.