Site updated: 2022-11-21 14:50:43
This commit is contained in:
5
rss.xml
5
rss.xml
@@ -28,8 +28,9 @@
|
||||
<category term="解决问题" scheme="https://blog.jingxiyuan.cn/categories/%E5%B7%A5%E4%BD%9C/%E8%A7%A3%E5%86%B3%E9%97%AE%E9%A2%98/" />
|
||||
<category term="mysql" scheme="https://blog.jingxiyuan.cn/tags/mysql/" />
|
||||
<pubDate>Mon, 21 Nov 2022 14:15:00 +0800</pubDate>
|
||||
<description><![CDATA[ <h4 id="引言"><a class="anchor" href="#引言">#</a> 引言</h4>
|
||||
<description><![CDATA[ <h4 id="问题描述"><a class="anchor" href="#问题描述">#</a> 问题描述</h4>
|
||||
<p>今天无意中发现原本能正常增加的 id 突然不变了,查看 sql 发现是取的对应表的自增 id。虽然存到表中的新数据自增 id 变化了,但返回的 id 总是不变。经过查询发现表的自增 id 是存在 information_schema 库中的 tables 表中。tables 表中存储了所有表的对应信息,其中有个 auto_increment 字段存储的就是对应表的下一个自增值。但是 mysql 在新版本中修改了此值的更新规则,老版本中是实时更新,新版本修改为 24 小时更新一次。为了不修改原代码中的逻辑,只能通过修改 mysql 配置使项目正常工作了。</p>
|
||||
<h4 id="解决办法"><a class="anchor" href="#解决办法">#</a> 解决办法</h4>
|
||||
<figure class="highlight yaml"><figcaption data-lang="YAML"></figcaption><table><tr><td data-num="1"></td><td><pre>mysql数据库auto_increment自增长不变的处理方法</pre></td></tr><tr><td data-num="2"></td><td><pre>修改/etc/mysql/mysql.conf.d/mysqld.cnf</pre></td></tr><tr><td data-num="3"></td><td><pre>增加一行information_schema_stats_expiry = 0</pre></td></tr><tr><td data-num="4"></td><td><pre>保存后重启mysql</pre></td></tr><tr><td data-num="5"></td><td><pre>sudo systemctl restart mysql.service</pre></td></tr><tr><td data-num="6"></td><td><pre></pre></td></tr><tr><td data-num="7"></td><td><pre>查询是否生效</pre></td></tr><tr><td data-num="8"></td><td><pre>show global variables like 'information_schema_stats_expiry';</pre></td></tr><tr><td data-num="9"></td><td><pre>show session variables like 'information_schema_stats_expiry';</pre></td></tr></table></figure> ]]></description>
|
||||
</item>
|
||||
<item>
|
||||
@@ -653,8 +654,8 @@ ip:极空间内网 ip<br />
|
||||
<link>https://blog.jingxiyuan.cn/2022/10/12/%E4%BD%BF%E7%94%A8picgo%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87%E5%88%B0chevereto/</link>
|
||||
<category term="Windows" scheme="https://blog.jingxiyuan.cn/categories/Windows/" />
|
||||
<category term="工具" scheme="https://blog.jingxiyuan.cn/categories/Windows/%E5%B7%A5%E5%85%B7/" />
|
||||
<category term="chevereto" scheme="https://blog.jingxiyuan.cn/tags/chevereto/" />
|
||||
<category term="PicGo" scheme="https://blog.jingxiyuan.cn/tags/PicGo/" />
|
||||
<category term="chevereto" scheme="https://blog.jingxiyuan.cn/tags/chevereto/" />
|
||||
<pubDate>Wed, 12 Oct 2022 14:40:00 +0800</pubDate>
|
||||
<description><![CDATA[ <h1 id="简介"><a class="anchor" href="#简介">#</a> 简介</h1>
|
||||
<p>PicGo 是一款开源的图床管理工具,十分流行。</p>
|
||||
|
||||
Reference in New Issue
Block a user