close

[Fixed] SQLSTATE[HY000]: General error: 1364 Field ‘name’ doesn’t have a default value laravel 5.5

Today We are Going To Solve SQLSTATE[HY000]: General error: 1364 Field ‘name’ doesn’t have a default value laravel 5.5 in Php. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

How to Fix SQLSTATE[HY000]: General error: 1364 Field ‘name’ doesn’t have a default value laravel 5.5 Error?

  1. How to Fix SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value laravel 5.5 Error?

    To Fix SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value laravel 5.5 Error just Change your config/database.php. to solve this issue you have to just change your config/database.php in the connections.mysql section by putting 'strict' => false. this will help you to solve the issue. Try it!

  2. SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value laravel 5.5

    To Fix SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value laravel 5.5 Error just Edit your migration script. Just edit your migration script and put default value on this field to solve the issue. You can learn it better by given the below example. I hope this will help you. $table->string('name')->default('');

Solution 1 : Change your config/database.php

to solve this issue you have to just change your config/database.php in the connections.mysql section by putting ‘strict’ => false. this will help you to solve the issue. Try it!

Solution 2 : Edit your migration script

Just edit your migration script and put default value on this field to solve the issue. You can learn it better by given the below example. I hope this will help you.

$table->string('name')->default('');

Solution 3 : Add the below code

To solve this error just add the below one to your migration file. It will help you.

$table->string('name')->nullable();

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read These Solutions

Leave a Comment