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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM