General help

Changing database prefix

 
 
Picture of Paul Smith
Changing database prefix
 

I understand that having the default database prefix on a moodle database presents security risks and am trying to changing it. When I try to do this I get errors. 

1. Will there be a mod to change it through the admin panel?

2. Is there a set of instructions to change the prefix?

3. Can it even be safely done without making future upgrades VERY painful?

 
Average of ratings: -
Picture of Andranik Sharabchian
Re: Changing database prefix
 

Hi Paul,

Find the row

$CFG->prefix = 'mdl_';

in  .../yourmoodle/config.php

and change it to other prefix, for example:

$CFG->prefix = 'paul_';

 
Average of ratings: -
Picture of Paul Smith
Re: Changing database prefix
 

You also have to change the prefix on the database. When I tried that and your suggestion the database gave errors

 
Average of ratings: -
Picture of Andranik Sharabchian
Re: Changing database prefix
 

Yes Paul, you are right. You must change the prefix on the database too. What kind of errors did database give?

 
Average of ratings: -