Swadesh
Swadesh

Reputation: 651

Why there is Invalid Default Value for the table in mysql

I executed the query below

ALTER TABLE `users` CHANGE `phone` `phone` VARCHAR( 20 ) 
    CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT NULL 

and result was ...

#1067 - Invalid default value for 'phone' 

Upvotes: 4

Views: 2556

Answers (2)

D Stanley
D Stanley

Reputation: 152491

You've set a default value of NULL for a column that can't be NULL

Upvotes: 1

Benjamin Gruenbaum
Benjamin Gruenbaum

Reputation: 276266

You're not allowing it to be null and then setting it to null as a default value.

Upvotes: 6

Related Questions