You are hereSetup Roundcube database tables with a prefix

Setup Roundcube database tables with a prefix


When trying to install Roundcube 0.6 on a MySQL database I was already using I kept getting issues as its tables already matched some for another installation (Drupal).

Theres not much documentation about actually changing these but you can do it manually before you start the installation by editing some files.

1. First install Roundcube and follow the installation steps until you end up with your two config files 'db.inc.php' and 'main.inc.php',

2. Open the 'mysql.initial.sql' and 'mysql.update.sql' files from the SQL folder in your Roundcube installation in your favourite text editor (mine is Komodo Edit).

3. Firstly, in your 'mysql.initial.sql' file edit any line with CREATE TABLE `xxxxx` to include your prefix.

For example:

Default line in file

CREATE TABLE `messages`

Change this to

CREATE TABLE `INSERTPREFIXHERE_messages`

If you're very clever you can do a find and replace for anything that = 'CREATE TABLE `' to replace it with 'CREATE TABLE `INSERTPREFIXHERE_'

4. Save your 'mysql.initial.sql'

5. Now do the same with the 'mysql.update.sql' file. Don't forget to update the following as well:

TRUNCATE TABLE `

ALTER TABLE `

6. Save your updated 'mysql.update.sql' file.

7. Upload the new files to your Roundcube installation.

8. Now open the 'db.inc.php' file you created with the installer

9. Edit the following to match your table prefix

// you can define specific table names used to store webmail data
$rcmail_config['db_table_users'] = 'INSERTPREFIXERE_users';

$rcmail_config['db_table_identities'] = 'INSERTPREFIXERE_identities';

$rcmail_config['db_table_contacts'] = 'INSERTPREFIXERE_contacts';

$rcmail_config['db_table_contactgroups'] = 'INSERTPREFIXERE_contactgroups';

$rcmail_config['db_table_contactgroupmembers'] = 'INSERTPREFIXERE_contactgroupmembers';

$rcmail_config['db_table_session'] = 'INSERTPREFIXERE_session';

$rcmail_config['db_table_cache'] = 'INSERTPREFIXERE_cache';

$rcmail_config['db_table_messages'] = 'INSERTPREFIXERE_messages';

10. Upload these files and complete the installation wizard by initialising your database.

Success!

This is actually a duplicate post as I did the same thing a couple of years ago but forgot I'd written it in a post! Anyway, it's a little more detailed than the last post so I won't delete it :)

Search

Advertising