Error of "SQLSTATE[HY000]: General error: 1364 Field 'field_name' doesn't have a default value"
Most of the time when we are working with MySQL we forgot to make an identification places where should be left blank and when we upload our database to server we face with error of "SQLSTATE[HY000]: General error: 1364 Field 'field_name' doesn't have a default value".
To handle this error , either you should identify a value for your column or you should say it might be a NULL
.So if you run that;
ALTER TABLE `tableName` CHANGE `columnName` `columnName` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;
Here VARCHAR (255)
will be whatever your column type is. Likewise, CHARACTER SET
and COLLATE
will change according to your database structure.
At worst, go to phpMyAdmin
to edit the column and mark the Null
part and save, you will get the same result :)
Comments
Popular Articles
Popular Tags
- #directive
- #Function
- #Json
- #Class
- #SASS
- #Form
- #Redirect
- #API
- #Special Characters
- #Special
- #Random
- #Generating
- #
- #Text
- #Ajax
- #URL
- #Encrypting
- #React
- #Show
- #timeAgo
- #PSR-4
- #Hide
- #DDOS Protection
- #DDOS
- #cURL
- #Logic For Displaying Posts
- #Error
- #Key
- #General Error
- #1364 Field
- #Abbreviation
- #Blade
- #Version
- #QR
- #QR Code Generating
- #Array
- #Arrays with Key Values to String Statement
- #Short Tag
- #Activate
- #Real Time
- #Socket.io
- #301
- #Custom Directives
- #Iframe Detection
- #Date
- #Characters
- #Insert
- #Autoloader
- #Composer
- #Reading
There are no comments, make the firs comment