如何删除mysql注释

Linux命令删除注释

先把库表导出成一个.sql文件,然后使用sed命令删除注释。此种适用于mysql端口不开外网的情况。

$ cat create_table.sql 
create table test1
(
    field_name int comment '字段的注释'
)comment='表的注释';

$ sed "s/comment.\'.*\'//" create_table.sql
create table test1
(
    field_name int 
);

修改information_schema表不可行

update information_schema.COLUMNS set COLUMN_COMMENT = '' where TABLE_SCHEMA = 'demo';

执行以上sql发现没有权限,是因为information_schema是只读表。

猜你喜欢

转载自www.cnblogs.com/aeolian/p/11635716.html