MySQL的auto_increment减5? [英] mysql auto_increment by 5?

查看:98
本文介绍了MySQL的auto_increment减5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个非常非常非常奇怪的mysql问题.

I'm running into a really, really, really weird problem with mysql.

我有一个主键"id".设置为自动递增.问题是,第一个条目从"3"开始.并且每个新条目增加5,因此下一个条目的ID是8,下一个是13,然后是18,依此类推.这真是愚蠢.为什么它不像应该的那样仅增加1?为什么从3开始呢?

I have a primary key, "id". It's set to auto increment. Problem is, first entry started at "3". And every new entry increases by 5, so the next entry's id is 8, the next is 13, then 18, so on. This is stupid. Why isn't it just incrementing by 1, like it should be? And why is it starting at 3???

我缺少某处的设置吗?我正在使用phpmyadmin,如果有帮助的话.

Is there some setting somewhere I'm missing? I'm using phpmyadmin, if that helps.

推荐答案

有一个my.cnf配置:

There's a my.cnf configuration for that: auto_increment_increment. It's used for master-master server setups to prevent the same key from being defined twice by two different servers. So using that coupled with auto_increment_offset, it allows each server to always generate unique ids...

因此,从您的描述来看,听起来像您这样:

So, from what you're describing, it sounds like you have this:

auto_increment_increment = 5
auto_increment_offset = 3

这篇关于MySQL的auto_increment减5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆