Hi!

My problem is that I've exported my drupal database to a file and imported it to another mysql server.
BUT! however I have several nodes, after importing, the auto_increment value starts from 0.

Is that possible to launch a query through drupal without direct access to the server to alter the auto increment's base value to a specific value?

I have full access to Drupal, but i cannot run a command prompt-like user interface on the server.

Please help!

Jeno1

Comments

knite’s picture

You might have to set the auto-increment value on the table if it did not get exported/imported properly. The SQL command looks something like the following:

ALTER TABLE foo AUTO_INCREMENT 42

tclineks’s picture

I think this only works for InnoDB, but try and report back Jeno.

knite’s picture

Jeno1, another thing, sending a sql command to the mysql server doesn't need command line access. Usually you can use something like phpmyadmin provided by your webhost. Otherwise, you might try this module: http://drupal.org/project/dba

I'm not the developer for it, but I've used it to some success. When I tried to import/export the entire db through the module, I run into some problems, but for changing some row values or table properties, it might serve your purpose.

As far as mysql help, try these pages:
AUTO_INCREMENT:
http://dev.mysql.com/doc/refman/4.1/en/example-auto-increment.html
ALTER TABLE:
http://dev.mysql.com/doc/refman/4.1/en/alter-table.html

vwegert’s picture

You didn't by any chance rename the tables? I just tripped over this problem yesterday - you'll have to keep the entries in the tables 'sequences' in sync with the table names, otherwise Drupal will start generating new IDs from 0 on...