Site Split & change table prefix

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
PBlue
Forum Members
Forum Members
Posts: 43
Joined: Tue Nov 07, 2006 5:54 am

Site Split & change table prefix

Post by PBlue »

I have an internal site which has many contents and I want to split it into three sites.

The requirements:
(1) Site A duplicates to Site B
(2) Site A duplicates to Site C
(3) Change the table prefix from "site_a_" to "site_b_" for Site B
(4) Change the table prefix from "site_a_" to "site_c_" for Site C

Please advise how to do this.

Site A is using version 1.11.2.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Site Split & change table prefix

Post by applejack »

For what reason do you want to do this ?
PBlue
Forum Members
Forum Members
Posts: 43
Joined: Tue Nov 07, 2006 5:54 am

Re: Site Split & change table prefix

Post by PBlue »

[quote="applejack"]For what reason do you want to do this ?[/quote

Just to be clear and make less confusing.

Initially I put "Windows Howto" and "Linux Howto" into one site and now there are a lot of contents inside it and I want to split into two sites - one is Windows Howto and another is Linux Howto. Tables in Windows Howto site will start with "howto_windows_" and tables in Linux Howto will start with "howto_linux_".
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Site Split & change table prefix

Post by applejack »

Why not just use 3 different databases named accordingly if you can.
PBlue
Forum Members
Forum Members
Posts: 43
Joined: Tue Nov 07, 2006 5:54 am

Re: Site Split & change table prefix

Post by PBlue »

Yes, I'm using three databases but I'm not sure if the table prefix names can be modified. If not, this is the acceptable solution as well.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Site Split & change table prefix

Post by applejack »

You can call the table prefixes whatever you like.
PBlue
Forum Members
Forum Members
Posts: 43
Joined: Tue Nov 07, 2006 5:54 am

Re: Site Split & change table prefix

Post by PBlue »

applejack wrote:You can call the table prefixes whatever you like.
Not sure if I need to modify the config.php:

$config['db_prefix'] = 'my_prefix_';

You mean just rename the tables with a new prefix and then restart Apache and cmsms will work?
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Site Split & change table prefix

Post by applejack »

Yes and yes you do need to change the config setting.
PBlue
Forum Members
Forum Members
Posts: 43
Joined: Tue Nov 07, 2006 5:54 am

Re: Site Split & change table prefix

Post by PBlue »

applejack wrote:Yes and yes you do need to change the config setting.
I tried:
(1) renamed ALL the table prefix
(2) changed $config['db_name'] = 'my_new_prefix';
(3) restart MySQL & Apache

But CMS only show the first page and the rest of the contents are gone. It seems that there must be some programs in CMSMS that hard coded the table prefix.

So, there should be more to be done to rename table prefix.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Site Split & change table prefix

Post by applejack »

Clear the cache in admin. Are you using mod rewrite for SEO friendly url's. Double check any htaccess and config files. Check server error logs. You can also switch on debug in the config file.
PBlue
Forum Members
Forum Members
Posts: 43
Joined: Tue Nov 07, 2006 5:54 am

Re: Site Split & change table prefix

Post by PBlue »

applejack wrote:Clear the cache in admin. Are you using mod rewrite for SEO friendly url's. Double check any htaccess and config files. Check server error logs. You can also switch on debug in the config file.
Yes, cache cleared. I'm using "mod_rewrite" for pretty URL.

I tried a newly install cmsms and the contents are all gone after renamename of table prefixes.

Table prefixes before: new_install_
Table prefixed after rename: fresh_install_

Config.php:
...
$config['db_name'] = 'new_install'; <-- db name unchanged
$config['db_port'] = 0;
$config['db_prefix'] = 'fresh_install_'; <-- table prefix changed
...

After rename, both Apache and MySQL have been restarted.

Admin log:
Admin Log.png
Contents gone after rename:
contents-gone.png
Table structure error as shown by cmsms:
table_strcuture_error.png
Locked

Return to “[locked] Installation, Setup and Upgrade”