Fork me on GitHub

如何删除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是只读表。

posted @ 2019-10-08 15:36  秋夜雨巷  阅读(2456)  评论(0编辑  收藏  举报