i don’t know the sql to run, but if you want to go in php myadmin and edit the tables, i found http://codex.ww.wp.xz.cn/Database_Description#Table:_wp_categories in the codex, and that told me where to turn on auto increment.
i was having the same issue, and it appears to have worked for me.