Categories

Featured templates

Drupal 7.x. How to apply snapshot to installed Drupal engine with custom database prefix

Ryan DeWitt February 25, 2015
Rating: 5.0/5. From 1 vote.
Please wait...

This tutorial shows how to apply snapshot to Drupal with custom database prefix.

Drupal 7.x. How to apply snapshot to installed Drupal engine with custom database prefix

Please open sites/default/settings.php file in editor. There you will see what database table prefix is being used in your Drupal installation.

How to apply snapshot to Drupal with custom database prefix-1

By default, Drupal does not assign prefix to database tables. That’s why demo profile is designed to be used for installations that do not have database prefixes.
Most hosting autoinstallers add prefixes like drup_ during Drupal installation. That is why issues with demo profiles occur. There are two methods you can use in order to resolve the issue:

  1. Reinstall Drupal using demo profile. In this case no prefix will be assigned to database prefix.

  2. You can modify .sql file specifically for custom database prefix and import it to database.

Reinstalling Drupal using demo profile

  1. Rename sites folder (located in your Drupal installation directory) to sites123 (for example).
    Upload sites folder from your template package to your server:

    How to apply snapshot to Drupal with custom database prefix-2

  2. Upload sources/demo_profile to profiles folder of your Drupal.

  3. Upload sources/install.inc file to includes folder and accept file replacement.
    Upload system.install file to modules/system folder and accept file replacement.

  4. Refresh your web site. You should get Drupal installation dialog. Select Demonstration site:

    How to apply snapshot to Drupal with custom database prefix-3

  5. Install Drupal to the clean database (you should remove database tables from previous installation).

  6. Select themeXXX snapshot. Click Restore:

    How to apply snapshot to Drupal with custom database prefix-4

  7. We can see that demo profile is applied:

    How to apply snapshot to Drupal with custom database prefix-5

  8. Refresh your site. We have applied demo profile:

    How to apply snapshot to Drupal with custom database prefix-6

Modifying .sql file specifically for custom database prefix and importing it to database

  1. Make sure that you have uploaded all template files according to template documentation.

  2. Upload sources/demo_profile to profiles folder of your Drupal.

  3. Be sure to back up current database. Open database management tool like PhPmyAdmin, open drupal database, select all tables and drop them:

  4. Open \sites\default\private\files\demo\themeXXX.sql file in editor. We should add database prefix to sql query. Open search and replace window of your editor. We are using Notepad++ software. You should press Ctrl+H in order to open search and replace dialog.
    Open Replace tab.

  5. Change all instances of CREATE TABLE IF NOT EXISTS ` to CREATE TABLE IF NOT EXISTS `drup_

    IMPORTANT: You should specify your database prefix instead of drup_

    How to apply snapshot to Drupal with custom database prefix-7

  6. We should perform the same actions to INSERT INTO ` query:

    How to apply snapshot to Drupal with custom database prefix-8

  7. Perform the same actions to Alter table query. Make sure that you have left space. Please check the screenshot for detailed information:

    How to apply snapshot to Drupal with custom database prefix-9

  8. Save changes you have performed to .sql file. Open Drupal database. Drop all tables in database and import sql file with sample data:

    How to apply snapshot to Drupal with custom database prefix-10

  9. Refresh your site. Template looks like the live demo with sample content:

    How to apply snapshot to Drupal with custom database prefix-11

Feel free to check the detailed video tutorial below:

Drupal 7.x. How to apply snapshot to installed Drupal engine with custom database prefix

Download Drupal Themes
This entry was posted in Drupal Tutorials and tagged custom, database, drupal, install, prefix, snapshot. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket