Does anybody know of anything in moodle that would cause problems if there were two seperate installations pointing at the same databsase and data directory ?
Another option would be to change the table name prefix in one of the installations so that you would use 1 database but have 2 different set of tables for each install.
For example, let's say you have the following:
Database Host - db33.mymy.net
Database Name - mountain
Database UserName - tim
Database PassWord - abcde
You can make the following changes in one of the "config" files.
WEBSITE I
$CFG->dbtype = 'mysql'; // mysql or postgres7 (for now)
$CFG->dbhost = 'db33.mymy.net'; // eg localhost or db.isp.com
$CFG->dbname = 'mountain'; // database name, eg moodle
$CFG->dbuser = 'tim'; // your database username
$CFG->dbpass = 'abcde'; // your database password
$CFG->prefix = 'mdl_'; // Prefix to use for all table names
WEBSITE II
$CFG->dbtype = 'mysql'; // mysql or postgres7 (for now)
$CFG->dbhost = 'db33.mymy.net'; // eg localhost or db.isp.com
$CFG->dbname = 'mountain'; // database name, eg moodle
$CFG->dbuser = 'tim'; // your database username
$CFG->dbpass = 'abcde'; // your database password
$CFG->prefix = 'mdl2_'; // Prefix to use for all table names
You can name either table prefix anything you want. I just used "mdl" and "mdl2" an examples ("mdl"is also the default prefix in the "config.php" file).
WP1
CORRECTED: August 2, 2004 WP1
Wow,
Thanks so much, Tim, for posting this. I had posted a similar question awhile back, but was not able to get a solution, probably because I didn't know how to ask it. (One Moodle, Multiple headers.)
I have a couple of questions, though. Tim, by "skin" to you mean a different theme for each install? And are the changes you mention in the config file similar to what WP1 has delineated?
And, WP1, what exactly does the Prefix to use for all table names do/mean?
It looks like you would have two installs of moodle--each with their own theme(?), but change the config files for each so that they both point to the same database, yet each to its own Prefix for table names(?). Am I close here at all?
Thanks for your help,
Chardelle
"It looks like you would have two installs of moodle--each with their own theme(?), but change the config files for each so that they both point to the same database yet each to its own Prefix for table names(?). Am I close here at all?" Chardelle Busch
You go girl!!!
All the prefixes do is let you know which database belongs to which site. That way you should be able to determine which site database you are making changes in or which one you need to repair or even delete.
The downside is, if you want to delete the database of one of the sites for whatever reason, you will have to click the box next to each table you need to remove (about 80) so you do not delete the set of tables for the other site's database you want to preserve.
If you have more than one database you would just delete the site database you wanted to remove. It is easier this way. Less "click" effort.
ONE DATABASE
Approach |
Number of Sites |
Number of DB |
DB prefix |
Result |
Tim | 2 or more | 1 | Same for each site in "config.php" | One set of tables for two different sites on one database |
WP1 * | 2 or more | 1 | Different for each site in "config.php" | Two or more sets of tables for two or more different sites on one database. Each table set has a different prefix name. |
* Take a look at the attached image. You will see parts of different table sets. One has the prefix "mdl_" the other "mdl14dev_". Both are on one database. Each set of tables serve one of two sites.
TWO OR MORE DATABASES
Approach |
Number of Sites |
Number of DB |
DB prefix |
Result |
Usual | Multiple | Multiple | Since each database has a separate name, the prefix can be the default "mdl_" in each database. | One set of tables in each different database. |
I know it is a bit wordy but I hope I was able to clear this up??
If anyone else has something to add to this, please do.
WP1
Uhhhhhh........
WP1 you are a doll, what did I every do without you? But....... now I am confused.
"If you have more than one database you would just delete the site database you wanted to remove. It is easier this way. Less "click" effort."
Okay, now are you saying that if you have two installs, but want to "share" a database, then just delete one database and point the config file to the shared database. I am assuming that installing Moodle automatically creates a database, and this database can subsequently be deleted if it isn't needed?
"All the prefixes do is let you know which database belongs to which site." "You will see parts of different table sets. One has the prefix "mdl_" the other "mdl14dev_". Both are on one database."
Are you talking about two installs each with their own data (table set) but both sharing a database? I'm still not sure about what this is. Could you maybe explain it in terms of a course. i.e., Site 1 has its own theme, but when its users log in, they will be going to the same course that users of Site 2 (with it own theme) go to? And the different table sets mean that...........?
Thx and thx again
Chardelle
This is quite different from the original question which is ONE site (common content and courses) appearing under two themes.
To achieve the latter you need one site set up normally, with a custom theme like "mytheme".
Then, on another web address, you set up a second Moodle, using a config.php that is almost exactly the same except for the $CFG->wwwroot. This second set of files ALSO has a "mytheme" theme folder, but it will contain different colours and styles etc. Apart from this one folder the rest of the Moodle files must be identical.
Chardelle, I decided to just do a full blown explnation with diagrams. I hope the attached image will help you understand what I am trying to describe. I have also taken into account Martin's comments about the $CFG->wwwroot. I am also asking him to review the image and see if the information is correct. Also, any Moodler who would like to comment, their input will be welcomed. I intend to submit it as a "HowTo" in the Document Course.
There is also a PDF file of the images below here (temporary) if it is easier to read that way.
Thanks in advance.
WP1
Corrected WP1 August 4, 2004
Appreciate the input. Good "rephasing" of what I am trying to convey Marcus and a good explanation of why (the reasons for the decision) you want to set up the database the way you want to Tim.
Will incorporate these thoughts in the update of the chart above. I think I need another column for indications for (the reasons for) the different database setups.
More opinions please!
WP1
Thanks everybody for the clarification.
I have been wanting to do exactly what Tim has mentioned. This can make it more cost effective for a company who would like to have their "own" customized training center, but perhaps do not have enough resources or users to afford or support their own course. This way they can share a course (perhaps being put into groups) with other companies, but to their employees it looks like their own company site.
I'll test it out and see how it goes.
Chardelle
That's precisely what I mean.
> yet each to its own Prefix for table names(?).
In my case they would all use the same prefix, the reason being to enable the exact same content to appear on both sites with different themes, but without actually having to maintain two seperate moodle installations.
Background :
We have a number of projects which each have there own website, up till now policy has been that all the learning material goes through a single website and the other projects just push through to this one master website. However, for presentational reasons we want to be able to present the material through all the sites and make it look like it is comming from each individual site, rather than one master site. From an administrative point of view, having multiple different moodle servers (ie using either a different database or prefix) would make life difficult from a maintenance point of view. However, using the same one means you only have to maintain one database setup.
This is also a very handy thing to do if you are delivering training to a corporate customer who wanted to have there own corporately themed version of the learning material. With this technique, you could do it very quickly, with no on going maintenance problems (unless you upgrade moodle, as martin says, you need to make sure everything bar the theme and config.php is identical in each copy).
In this setup, what about instructors? Does this mean that if you give one client Instructor access, they will be able to see ALL the students enrolled? Even those of other clients?
If so, how can this be prevented?
I believe that is correct Jovi...using this set-up, the different Moodle installs are "looking at, and in fact, using" the same data in the same tables, so everyting would be available for both installs...sort of like two computers using the same hard drive.
This is an old thread, but I would be interested to hear how this worked. It seems like there could be problems if one person tried to change some systemwide variable because that would change the way both sites worked. For example, if one site set moodle to "force login" then all sites using that database would be forced login.
If you need multiple moodle installs to operate "independently" then you could still use a single database, but each install would need its own tables...controlled by table prefixes...like WP explained above.
I don't have two moodle installs using a single database, but I do have 68 Wordpress blogs using a single database (13 tables each = 884 tables). I use these for a class I teach (actually three classes) so each of my students can have their own blog to practice with. There is probably some reason why I shouldn't have that many tables in a single database, but it has worked well for me for the past 6 months
Steve