Kind of obvious but may help some people as I couldn’t find anything in the manager interface to do this. Long after installation I discovered I wanted multiple modx sites to share the same database. The obvious way is to give each site a unique prefix for the table names, I chose to use the company name. Trouble is the first one had prefix ’modx_’ and I wanted to change it for tidyness.
So my database name was modx and the database owner was modx, using the mysql tee command I listed all the tables to a text file.
mysql -u modx -p modx<br />give password<br />tee tempfile;<br />show tables;<br />\q<br />
I edited tempfile to remove noise characters and create a sql script to rename the tables
my approach was to put a procedure at the top like
foo() {<br />echo RENAME OLDPFX_$1 TO NEWPFX_$1 ’;’<br />}<br />
then globally replace all occurrences of OLDPFX_ to ’foo ’
exit the editor and run the script saving the output
sh tempfile >rename.sql
then use mysql to do the renames
mysql -u modx -p modx<br />\. rename.sql<br />\q<br />
Finally edit manager/includes/config.inc.php to change the table prefix to NEWPFX_
Ed