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

      • <bdo id='ntHhV'></bdo><ul id='ntHhV'></ul>

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

      <tfoot id='ntHhV'></tfoot>

      1. <legend id='ntHhV'><style id='ntHhV'><dir id='ntHhV'><q id='ntHhV'></q></dir></style></legend>

        MySQL自增主键增加10

        MySQL Auto increment primary key increases by 10(MySQL自增主键增加10)

          <legend id='4T0yK'><style id='4T0yK'><dir id='4T0yK'><q id='4T0yK'></q></dir></style></legend>

          <small id='4T0yK'></small><noframes id='4T0yK'>

        1. <i id='4T0yK'><tr id='4T0yK'><dt id='4T0yK'><q id='4T0yK'><span id='4T0yK'><b id='4T0yK'><form id='4T0yK'><ins id='4T0yK'></ins><ul id='4T0yK'></ul><sub id='4T0yK'></sub></form><legend id='4T0yK'></legend><bdo id='4T0yK'><pre id='4T0yK'><center id='4T0yK'></center></pre></bdo></b><th id='4T0yK'></th></span></q></dt></tr></i><div id='4T0yK'><tfoot id='4T0yK'></tfoot><dl id='4T0yK'><fieldset id='4T0yK'></fieldset></dl></div>
        2. <tfoot id='4T0yK'></tfoot>
              <tbody id='4T0yK'></tbody>

                  <bdo id='4T0yK'></bdo><ul id='4T0yK'></ul>
                • 本文介绍了MySQL自增主键增加10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 azure 上,我创建了一个新的 MySQL 数据库实例.在这个数据库中,我使用这个脚本创建了一个表:

                  On azure I created a new MySQL Database instance. In this db I create a table using this script:

                  CREATE TABLE ROLES(
                    ID INTEGER PRIMARY KEY AUTO_INCREMENT,
                    ROLE_NAME VARCHAR(30) NOT NULL
                  );
                  

                  然后我使用这个脚本插入值:

                  Then I insert values using this script:

                  INSERT INTO `beezzy`.`roles` (`ROLE_NAME`) VALUES ('admin');
                  INSERT INTO `beezzy`.`roles` (`ROLE_NAME`) VALUES ('owner');
                  INSERT INTO `beezzy`.`roles` (`ROLE_NAME`) VALUES ('consultant');
                  

                  执行后表包含这样的行:

                  after execution table contains such rows:

                  为什么 DB 会生成像11"和21"这样的 ID?我在本地机器上运行相同的脚本,一切正常.ID 为1"、2"、3"

                  Why DB generates IDs like '11' and '21'? I run the same script on my local machine and everything works fine. IDs was '1', '2', '3'

                  推荐答案

                  请运行以下查询.

                  SELECT @@auto_increment_increment

                  如果值大于 1,则通过以下查询将其设置为 1:

                  If the value is more than 1 then set it to 1 by the following query:

                  SET @@auto_increment_increment=1;

                  注意:此更改仅对当前连接可见.

                  Note: This change is visible for the current connection only.

                  为了全局设置它以便其他连接也可以看到您需要为全局和会话设置它的更改.

                  In order to set it globally so that other connections can also see the change you need to set it for global and session too.

                  SET @@GLOBAL.auto_increment_increment = 1;
                  
                  SET @@SESSION.auto_increment_increment = 1;
                  

                  因此其他连接现在可以看到此更改.

                  So other connections can see this change now.

                  更多:

                  如果您重新启动 MySQL 服务器,此值将被重置.为了使此更改永久化,您需要在 my.cnf [for linux]my.ini [forwindows] 文件.

                  This value will be reset if you restart your MySQL server. In order to make this change permanent you need to write this variable under [mysqld] secion in your my.cnf [for linux] or my.ini [for windows] file.

                  [mysqld]
                  auto-increment-increment = 1
                  

                  这篇关于MySQL自增主键增加10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  SELECT INTO using Oracle(使用 Oracle SELECT INTO)
                  PL/SQL - Use quot;Listquot; Variable in Where In Clause(PL/SQL - 使用“列表Where In 子句中的变量)
                  Oracle JDBC ojdbc6 Jar as a Maven Dependency(Oracle JDBC ojdbc6 Jar 作为 Maven 依赖项)
                  ORA-01882: timezone region not found(ORA-01882: 未找到时区区域)
                  Oracle SQL - How to Retrieve highest 5 values of a column(Oracle SQL - 如何检索列的最高 5 个值)
                  How does GROUP BY work?(GROUP BY 如何工作?)
                • <legend id='AjJA3'><style id='AjJA3'><dir id='AjJA3'><q id='AjJA3'></q></dir></style></legend>

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

                      <bdo id='AjJA3'></bdo><ul id='AjJA3'></ul>
                      <tfoot id='AjJA3'></tfoot>

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