How do you alter a MySQL table to make a column nullable?

Do this:

<span class="kwd" style="font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #101094;">ALTER</span> <span class="kwd" style="font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #101094;">TABLE</span><span class="pln" style="font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;"> mytable MODIFY mycolumn VARCHAR</span><span class="pun" style="font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">(</span><span class="lit" style="font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #7d2727;">255</span><span class="pun" style="font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">);</span>

Ps. You have to know what the original type is.

Reference:

https://stackoverflow.com/questions/212939/how-do-i-modify-a-mysql-column-to-allow-null

 

Share this article

Leave a Reply

Your email address will not be published.

Scroll to Top