Drupal multi sit setup fails when changing database name, using mysql and apache2.2 on a windows install.

jimmylew52
jimmylew52 used Ask the Experts™
on
I have copied the production site to a folder called test.prod.com. I have made a bckup of the prod data base in phpmyadmin and restored it to a data base called prodtest.I have edited the settings.php file to point to the new data base and foint to the site test.prod .com.

Without running the install.php file I get error  table XXXXprodtest does not exist in the database. several of these errors.

If i run the install PHP file I do not get the original web site to use for testing.

How do I create the test site from the original production site?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chief Technology Officer
Most Valuable Expert 2011
Commented:
Hopefully you will get some additional thoughts here shortly, but it appears the issue is that Drupal names the tables according to the original database name you choose during install (execution of install.php); therefore, if you want to use your original site content under new domain/database, you will likely have to rename the tables: http://dev.mysql.com/doc/refman/4.1/en/rename-table.html

Otherwise, you could try using install.php as you have done to get the database structure in place and then using SQL scripts insert data from the other database to the new one.

e.g.,
INSERT INTO db2.tablename({column list}) SELECT {column list} FROM db1.tablename;
http://dev.mysql.com/doc/refman/4.1/en/insert.html

Hope that helps!
When you move a Drupal database to a new location, you can't just import the database because Drupal will have put several references to the real location in the database.
You should do a find and replace in the database script to see where these references exist.

For example, I develop a drupal site on mydevsite.com and then I move it to myrealwebsiteurl.com. I do a search in the database script for all references to mydevsite.com, or homt/somefolder/mydevsite
and change them to the new web address.
I was JUST doing this today, so it is fresh in my mind. Make sure you search for mydevsite and not just mydevsite.com.

Author

Commented:
Both answers were correct but the basis of my problem wa that the phpmyadmin program i was using to copy to database was not making a good copy. After getting a good copy of the database and applying the information above my problem was solved.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial