Skip to content

Instantly share code, notes, and snippets.

@canabady
Last active February 6, 2017 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save canabady/5c67bfcac3f881e9cdc005ceb48f6105 to your computer and use it in GitHub Desktop.
Save canabady/5c67bfcac3f881e9cdc005ceb48f6105 to your computer and use it in GitHub Desktop.
How to alter a column and change the default value in MYSQL ?
/* How to alter a column and change the default value in MYSQL ? */
ALTER TABLE foobar_data MODIFY COLUMN col VARCHAR(255) NOT NULL DEFAULT '{}';
/* A second possibility which does the same (thanks to juergen_d): */
/* --------------------------------------------------------------- */
ALTER TABLE foobar_data CHANGE COLUMN col col VARCHAR(255) NOT NULL DEFAULT '{}';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment