UncleBubba
asked on
Duplicate and Re-prefix Tables in a MySQL Database with PHPMyAdmin
Hello, I have a (hopefully) simple but very specific question regarding database management.
I have a single MySQL database containing all of the relevant tables for a live Joomla installation.
I want to make another joomla installation using the same table data but with a different prefix so, using PHPMyAdmin, I want to duplicate the existing tables but I want the newly created duplicates to have a new prefix.
For example:
Let's say that there are currently 50+ tables (rows?? tables??) called things like:
joom_users (xx;xx;xxxx;)
joom_headers(yy;xx;xxxx)
etc.
I want to make exact copies of all tables prefixed with joom_ but I want all of the duplicates to be prefixed joom2_ so that you end up with
joom_users (xx;xx;xxxx)
joom_headers (yy;xx;xxxx;)
joom2_users (xx;xx;xxxx;)
joom2_headers(yy;xx;xxxx)
etc.
Is this possible with PHPMyAdmin?
How (exactly please) would I go about this?
I have a single MySQL database containing all of the relevant tables for a live Joomla installation.
I want to make another joomla installation using the same table data but with a different prefix so, using PHPMyAdmin, I want to duplicate the existing tables but I want the newly created duplicates to have a new prefix.
For example:
Let's say that there are currently 50+ tables (rows?? tables??) called things like:
joom_users (xx;xx;xxxx;)
joom_headers(yy;xx;xxxx)
etc.
I want to make exact copies of all tables prefixed with joom_ but I want all of the duplicates to be prefixed joom2_ so that you end up with
joom_users (xx;xx;xxxx)
joom_headers (yy;xx;xxxx;)
joom2_users (xx;xx;xxxx;)
joom2_headers(yy;xx;xxxx)
etc.
Is this possible with PHPMyAdmin?
How (exactly please) would I go about this?
ASKER
Thanks richdiesal.
I will try this later, then return to assign points
Being a lazy sod, is there a way to make it automatically do this for any table whose name begins with joom_ without having to type in each line?
I will try this later, then return to assign points
Being a lazy sod, is there a way to make it automatically do this for any table whose name begins with joom_ without having to type in each line?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You are the proverbial diamond, thanks for your excellent help.
CREATE TABLE joom2_users AS SELECT * FROM joom_users;
Just create one line per table you want to duplicate... you can enter this SQL directly by clicking on the "SQL" tab at the top of PHPMyAdmin.