Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2011-01-10 10:09:26
- Dimitri
- Member
- From: Johannesburg
- Registered: 2010-10-31
- Posts: 129
How to reset article id, image id from MySQL
Hi peeps.
I built a default website, so I can import ready made backend for future websites, I underwent lots of testing during development.
After importing to a new site, I would like to reset the article id and image id so it can be started from scratch. How can I do that, I am very weak with MySQL?
Thanx.
<txp:way_too_cool />
Offline
Re: How to reset article id, image id from MySQL
TRUNCATE `tablename`;
will delete all rows from the table and reset any auto-increment counters to 0.
To preserve existing rows, use ALTER TABLE `tablename` AUTO_INCREMENT = 999;
after substituting the desired value (must be higher than any existing row) for ‘999’.
Code is topiary
Offline
#3 2011-01-10 17:31:24
- Dimitri
- Member
- From: Johannesburg
- Registered: 2010-10-31
- Posts: 129
Re: How to reset article id, image id from MySQL
Where can i find that?
<txp:way_too_cool />
Offline
Re: How to reset article id, image id from MySQL
Find what?
Code is topiary
Offline
Re: How to reset article id, image id from MySQL
You need to use some sort of mysql administrative utility
phpAdmin is quite commonly used by hosting companies. It let’s you administer your database from your browser. There are also desktop apps that you can use to log in and administer your database.
Last edited by maverick (2011-01-10 17:52:12)
Offline
#6 2011-01-10 21:10:00
- Dimitri
- Member
- From: Johannesburg
- Registered: 2010-10-31
- Posts: 129
Re: How to reset article id, image id from MySQL
Sorry, i should have been more specific. I am using phpmyadmin, and I dont know where to find to modify the auto-increment.
<txp:way_too_cool />
Offline
Re: How to reset article id, image id from MySQL
Go to the Query tab (in phpMyAdmin) and run one of the queries (in the ‘SQL query’ box at bottom right) I listed above, either:
TRUNCATE `tablename`;
or
ALTER TABLE `tablename` AUTO_INCREMENT = 999;
You have two tables, (`textpattern` and `txp_image`), so two queries. The first form will delete any existing rows in the table. The second form will not, but you’ll need to put in the correct number (one greater than the highest existing id value).
Last edited by jsoo (2011-01-10 21:20:50)
Code is topiary
Offline
#8 2011-01-10 21:27:16
- Dimitri
- Member
- From: Johannesburg
- Registered: 2010-10-31
- Posts: 129
Re: How to reset article id, image id from MySQL
Thanx
<txp:way_too_cool />
Offline