I installed Drupal on my site and had been playing with it to learn how it works, and I created and deleted some test pages (what made the node counter go up). Now I will start working seriously with the site, but I want the node counter to start from 1 again.

So I want to know how do I reset this number.

Note: I have already deleted all the test pages, so it will not have any duplicate entry after the count is reseted.

Thanks!

Comments

vm’s picture

This has come up a few times in the recent past, you can't without a whole lot of headache. If it's that important to you, reinstall drupal to obtain a fresh DB where you can then start at node/1 if it matters that much. Most use path aliases where the node/# doesn't matter as users don't see that path at all.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

alihammad’s picture

try resetting the auto increment number of nid field in drupal database's table node and node_comment_statistics table to 0. Assuming you know a little mysql, a simple alter statement would do.

These two tables use nid auto increment. I couldn't find any other table using auto inc for nid. Make sure you have zero nodes before this alter.

Ali Hammad Raza
WordsValley

vm’s picture

backup the DB before you make these kinds of alterations and test THOROUGHLY afterwards.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

Tiago Paolini’s picture

Thanks for the suggestions! It is not really that important, I can live with it if I cannot manually reset ;)

But I will give it a try to see if it works. Do not worry, I will backup the DB before attempting.

shariharan’s picture

This is what I do..

Create a page and add the below code. I keep the page unpublished so that users cannot reach it. Hope it helps


<?php
echo "This page runs a script that clears the Clear Most Popular Count.<br>";
db_query("DELETE FROM {node_counter} WHERE 1");
echo "It's clear now.<br>";
?>

Drupal Scavenger

dave reid’s picture

The Statistics Advanced module will have this feature.