How to configure the structure of a mysql database
Is it possible to restore the previous state of a mysql database through phpmyadmin? I have one column in 4 of the tables that have the auto increment. And my problem is how to begin a开发者_开发问答gain in the count of number 1 when I try to add a data. I tried deleting all the records then add a record but it doesn't start with 1. How do I do this without building the database over again by typing and selecting the data types. What I want to do is to start the counting from 1 again. Is it possible?
Open phpMyAdmin and then select the DB you wish to change from the top left panel. Now click the "query" button also top left to open a query window where you can then run the sql code below to reset the auto increment count for your table.
ALTER TABLE your_table_name AUTO_INCREMENT=1
If you dont care about the data in the table you can just hit the empty button (make sure you are on the right table). That will tuncate your table and anything you add after that will start at 1. If you set a field to auto increment then each item after that will increase by 1.
Have you tried ...
ALTER TABLE t2 AUTO_INCREMENT = 1;
It will reset the value to the smallest value allowed. Other than that you are out of luck.
精彩评论