Home  >  Article  >  Database  >  How to modify the default value of a column in mysql

How to modify the default value of a column in mysql

王林
王林Original
2020-10-13 16:31:4213050browse

How to modify the default value of a column in MySQL: directly execute the [alter table table name alter column field name set default default value;] statement to modify the default value.

How to modify the default value of a column in mysql

If there is a default value, delete it first

(recommended tutorial: mysql video tutorial)

alter table表名alter column字段名drop default;

Then set the default value (if it does not exist, you can set it directly)

alter table表名 alter column字段名 set default默认值;

Related recommendations: mysql tutorial

The above is the detailed content of How to modify the default value of a column in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn