如何删除mysql注释

Posted aeolian

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何删除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是只读表。

以上是关于如何删除mysql注释的主要内容,如果未能解决你的问题,请参考以下文章