Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have a drupal 7 site running on a webserver, it is currently using a database that was created with out a prefix.

I am attempting to restore that database to a new drupal instance from a shared hosting provider. I am using the Backup and Restore Module to move the database. One thing I have no apparent control of is that their "quick install script" creates a new drupal database with a "drupal_" prefix.

Do I need to convert my existing database to have that prefix, because as it seems now my migrated changes are not even being read since it probably has both sites data sitting side by side, and the database information I want to be reading entries from don't have the prefix? Is that reasoning correct? If so how do I convert my Drupal database to the same one but now with the necessary prefix applied throughout?

share|improve this question
if the generated mysql dump file is not that big, then you can extract the file and edit database name by adding drupal_ prefix – Aboodred1 Mar 20 at 15:14

2 Answers

Your reasoning sounds correct to me. You could try to edit your database dump, adding the prefix to all table names, and run the import again. This will surely work but it's also easy to make a mistake, so you may have some trial-and-error before you succeed.

Another option would be to go into the new database with a tool like phpMyAdmin, drop the prefixed tables and alter the non-prefixed ones adding the prefix.

A third method (which may or may not collide with the automatic installer you used) is to edit the settings.php and remove the prefix from the database array. While this is probably the fastest solution for now, I'm not sure if it will last in the ling run, for instance when the automatic installer does an upgrade.

share|improve this answer

If it is just the database with the 'drupal_' prefix, you do not need to create a table prefix.

The database dump created by the Backup and Restore module does not include any database definition.

If you need it, you can extract the mysqldump file and add the following to the top of the file:

CREATE DATABASE IF NOT EXISTS 'drupal_mydatabase';
USE 'drupal_mydatabase';

Otherwise, just change your database credentials in settings.php, and use the Backup and Restore module to reload your database.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.