GIVE IT A TRY !!! UPDATE 14:57 EDTĪ comment from JohnathanFite brings up a valid point: So, if you have the necessary grants to do this. | GRANT ALL PRIVILEGES ON *.* TO WITH GRANT OPTION | Of course, I did this with all privileges: mysql> SELECT user(),current_user() ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1Īs shown, the auto_increment of the table was incremented from 14 to 15. Mysql> PREPARE s FROM OK, 0 rows affected (0.00 sec) | ALTER TABLE ganeshbora.customer AUTO_INCREMENT=15 | > WHERE AND OK, 1 row affected (0.00 sec) Mysql> SELECT CONCAT('ALTER TABLE AUTO_INCREMENT=',auto_increment+1) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 `cust_id` int(11) NOT NULL AUTO_INCREMENT, Mysql> SHOW CREATE TABLE ganeshbora.customer\G SAMPLE CODE EXECUTED mysql> SET = 'ganeshbora' I just tried this with a table ganeshbora.customer on my Windows laptop (5.7.12) SAMPLE CODE SET = 'ganeshbora' WHERE AND s FROM EXECUTE s DEALLOCATE PREPARE s Īfter running this, you can verify with SHOW CREATE TABLE mydb.mytable\G SELECT CONCAT('ALTER TABLE AUTO_INCREMENT=',auto_increment+1) I make no promises with this one, but you might get away with the following:įor a table mytable in the mydb database SET = 'mydb'
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |