<i id='uAtje'><tr id='uAtje'><dt id='uAtje'><q id='uAtje'><span id='uAtje'><b id='uAtje'><form id='uAtje'><ins id='uAtje'></ins><ul id='uAtje'></ul><sub id='uAtje'></sub></form><legend id='uAtje'></legend><bdo id='uAtje'><pre id='uAtje'><center id='uAtje'></center></pre></bdo></b><th id='uAtje'></th></span></q></dt></tr></i><div id='uAtje'><tfoot id='uAtje'></tfoot><dl id='uAtje'><fieldset id='uAtje'></fieldset></dl></div>

    1. <small id='uAtje'></small><noframes id='uAtje'>

    2. <legend id='uAtje'><style id='uAtje'><dir id='uAtje'><q id='uAtje'></q></dir></style></legend>
      <tfoot id='uAtje'></tfoot>
        <bdo id='uAtje'></bdo><ul id='uAtje'></ul>

    3. mysqldump - 仅导出结构而没有自动增量

      时间:2023-07-17
      <legend id='IgXxS'><style id='IgXxS'><dir id='IgXxS'><q id='IgXxS'></q></dir></style></legend>

        <bdo id='IgXxS'></bdo><ul id='IgXxS'></ul>

        <small id='IgXxS'></small><noframes id='IgXxS'>

      • <i id='IgXxS'><tr id='IgXxS'><dt id='IgXxS'><q id='IgXxS'><span id='IgXxS'><b id='IgXxS'><form id='IgXxS'><ins id='IgXxS'></ins><ul id='IgXxS'></ul><sub id='IgXxS'></sub></form><legend id='IgXxS'></legend><bdo id='IgXxS'><pre id='IgXxS'><center id='IgXxS'></center></pre></bdo></b><th id='IgXxS'></th></span></q></dt></tr></i><div id='IgXxS'><tfoot id='IgXxS'></tfoot><dl id='IgXxS'><fieldset id='IgXxS'></fieldset></dl></div>

                  <tbody id='IgXxS'></tbody>

                <tfoot id='IgXxS'></tfoot>

                本文介绍了mysqldump - 仅导出结构而没有自动增量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个 MySQL 数据库,我正在尝试找到一种仅导出其结构的方法,而没有自动增量值.mysqldump --no-data 几乎可以完成这项工作,但它保留了 auto_increment 值.有没有什么方法可以不使用 PHPMyAdmin(我知道它可以做到)?

                I have a MySQL database and I am trying to find a way to export its structure only, without the auto increment values. mysqldump --no-data would almost do the job, but it keeps the auto_increment values. Is there any way to do it without using PHPMyAdmin (that I know it can do it)?

                推荐答案

                你可以这样做:

                mysqldump -u root -p -h <db-host> --opt <db-name> -d --single-transaction | sed 's/ AUTO_INCREMENT=[0-9]*//' > <filename>.sql
                

                正如其他人提到的,如果您希望 sed 正常工作,请添加 g(用于 g 局部替换)参数,如下所示:

                As mentioned by others, If you want sed to works properly, add the g (for global replacement) parameter like this :

                mysqldump -u root -p -h <db-host> --opt <db-name> -d --single-transaction | sed 's/ AUTO_INCREMENT=[0-9]*//g' > <filename>.sql
                

                (这仅在您安装了 GUI 工具时才有效:mysqldump --skip-auto-increment)

                (this only works if you have GUI Tools installed: mysqldump --skip-auto-increment)

                 没有用,有时会破坏命令.请参阅此SO 主题以获取解释.所以优化的答案是:

                The  is useless and sometimes will break the command. See this SO topic for explanations. So the optimized answer would be :

                mysqldump -u root -p -h <db-host> --opt <db-name> -d --single-transaction | sed 's/ AUTO_INCREMENT=[0-9]*//g' > <filename>.sql
                

                这篇关于mysqldump - 仅导出结构而没有自动增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:mysql 无法从存储引擎读取自动增量值 下一篇:表存在后添加新ID(自动增量)的麻烦

                相关文章

              • <tfoot id='5158I'></tfoot>

                <legend id='5158I'><style id='5158I'><dir id='5158I'><q id='5158I'></q></dir></style></legend>

                <small id='5158I'></small><noframes id='5158I'>

                <i id='5158I'><tr id='5158I'><dt id='5158I'><q id='5158I'><span id='5158I'><b id='5158I'><form id='5158I'><ins id='5158I'></ins><ul id='5158I'></ul><sub id='5158I'></sub></form><legend id='5158I'></legend><bdo id='5158I'><pre id='5158I'><center id='5158I'></center></pre></bdo></b><th id='5158I'></th></span></q></dt></tr></i><div id='5158I'><tfoot id='5158I'></tfoot><dl id='5158I'><fieldset id='5158I'></fieldset></dl></div>

                    <bdo id='5158I'></bdo><ul id='5158I'></ul>