How to Reset NID in Drupal 6

Drupal 6 is a content management system developed under an open-source license. It provides tools for the creation and maintenance of websites and community portals. Published content in Drupal 6 takes the form of nodes and include formats like pages, articles, photo galleries and contact forms. Each individual node is given a unique node identifier, or NID. The base NID offset means that each node created will increase by one, regardless of deletions or the type of node created. Resetting the NID can cause issues with the database, so it is wise to back up content and delete prior to resetting the node identifier.

Things You'll Need

  • File compression software
  • FTP client
Show More

Instructions

    • 1

      Download the Delete All module (see Resources). Use the file compression software to extract the module to your desktop. Open the FTP client and log in to your Drupal website. Navigate to "sites/all/modules" and upload the extracted folder.

    • 2

      Log in to your website as an administrator. Navigate to the "Site Configuration" option, then select "Modules." Scroll down to "Delete All" and "PHP Snippets," then check the "Enable" box. Click "Save Configuration."

    • 3

      Click the "Delete All" option under "Site Configuration," specify node_type as "All" then click "Delete."

    • 4

      Navigate to "Site Configuration," then "Content." Click "Add Content." Change the input type from "Filtered HTML" to "PHP Snippets." Click on the text entry box and paste in the following PHP snippet:

      <?php

      mysql_connect("$SQL_Host", "$SQL_User", "$SQL_Pass");

      mysql_select_db("$SQL_DB");

      ALTER TABLE 'node' AUTO_INCREMENT=1

      ?>

      To reset the NID.

Tips & Warnings

  • Back up your content and database prior to making drastic changes to tables or configuration.

Related Searches:

References

Resources

Comments

Related Ads

Featured