Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

_Zaman's avatar

auto increments id is not working after hosting file.

Hi, I just add my laravel project in my cpanel but when I try to add it's showing an error. SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value although I created auto increments my id column and it's working fine in localhost but showing this error after adding it to live server.

0 likes
4 replies
Snapey's avatar

how did you initialise the database?

_Zaman's avatar

@Snapey For every table migration I just used $table->increments('id');. Now I just select my mysql db and export it then Imports it to hosting.

tislam's avatar

hi _Zaman I'm having the same problem. you solve it? If you can help me.

siangboon's avatar

did you notice any error/warning message when you run the migration??? for workaround, you could double check the table column is set to auto incremetn...

Please or to participate in this conversation.