Mysql Error Code : 1436 Thread stack overrun

所属分类: 数据库 / Mysql 阅读数: 386
收藏 0 赞 0 分享

ERRNO: 256 
TEXT: SQLSTATE[HY000]: General error: 1436 Thread stack overrun: 4904 bytes used of a 131072 byte stack, and 128000 bytes needed. Use 'mysqld -O thread_stack=#' to specify a bigger stack. 

According to the MySQL manual “The default (192KB) is large enough for normal operation. If the thread stack size is too small, it limits the complexity of the SQL statements that the server can handle, the recursion depth of stored procedures, and other memory-consuming actions” .

To resolve this issue you need to change the default value of parameter 'thread_stack' in /etc/my.cnf  in your MySQL configuration file. I use the XAMPP for php/mysql development. 

Once you set this value you need to restart MySQL as this value cannot be set dynamically.

you maybe also encounter with the message when you try to modify the my.cnf

"Cannot open file for writing: Permission denied"

We will try to use the 'chmod' instruction to change permission as usually. I seldom take the concrete permission into consideration, so I use always use the 'chmod 777'. but it resulted in another errors when I use the phpmyadmin, another tools included in XAMPP, after running 'chmod 777'.

After googling it, I get this file (my.cnf) permissions has to be 600. I change its permission and it works well now.

bug info

报错信息:
java.sql.SQLException: Thread stack overrun: 5456 bytes used of a 131072 byte stack, and 128000 bytes needed. Use 'mysqld --thread_stack=#' to specify a bigger stack.

官方相应信息:

The default (192KB) is large enough for normal operation. If the thread stack size is too small, it limits the complexity of the SQL statements that the server can handle, the recursion depth of stored procedures, and other memory-consuming actions

可以使用

show variables where `variable_name` = 'thread_stack';

查询当前数据库的默认线程栈的大小,一般情况下都能正常使用,但是当查询语句或者存储过程复杂时会报Thread stack overrun错误,此时只要修改默认配置就可以。

解决

windows: 修改mysql安装目录下的my-small.ini或者my.ini设置为256k,或者更大,然后重启服务

[mysqld]
thread_stack = 256k
linux: 同样要修改配置文件,但是!!!,不是安装目录下的配置文件,是/etc/my.cnf,只有这个文件才能生效,然后重启服务service mysql restart

[mysqld]
thread_stack = 256k

其实针对32位系统,32G内存,一般设置为512K即可,据国外网站看到的,如果是64位的系统可以适当增加,其实够用就好了,没必须刚开始设置的就很大。

更多精彩内容其他人还在看

MariaDB(MySQL)创建、删除、选择及数据类型使用详解

这篇文章主要介绍了MariaDB(MySQL)创建、删除、选择及数据类型使用详解的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

mysql索引学习教程

在mysql 中,索引可以分为两种类型 hash索引和 btree索引。这篇文章主要介绍了mysql索引的相关知识,非常不错,具有参考借鉴价值,感兴趣的朋友一起看看吧
收藏 0 赞 0 分享

MySQL修改默认字符集编码的方法

这篇文章主要介绍了MySQL修改默认字符集编码的方法的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL中实现插入或更新操作(类似Oracle的merge语句)

这篇文章主要介绍了在MySQL中实现插入或更新操作(类似Oracle的merge语句)的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

mysql5.x升级到mysql5.7后导入之前数据库date出错的快速解决方法

这篇文章主要介绍了mysql5.x升级到mysql5.7后导入之前数据库date出错的快速解决方法,非常不错,具有参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

LNMP下使用命令行导出导入MySQL数据库的方法

这篇文章主要介绍了LNMP下使用命令行导出导入MySQL数据库的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

MySql中的IFNULL、NULLIF和ISNULL用法详解

在做项目中发现MySql里的isnull和mssql里的有点不同。接下来小编通过本文给大家介绍MySql中的IFNULL、NULLIF和ISNULL用法详解的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

Mysql 5.7 服务下载安装图文教程(经典版)

MySQL 5.7在诸多方面都进行了大幅的改进,主要在于安全性、灵活性、易用性、可用性和性能等几个方面。这篇文章主要介绍了Mysql5.7服务下载安装图文教程(经典版),需要的朋友可以参考下
收藏 0 赞 0 分享

SQL重复记录查询 查询多个字段、多表查询、删除重复记录的方法

下面小编就为大家带来一篇SQL重复记录查询 查询多个字段、多表查询、删除重复记录的方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

mysql socket文件作用详解

这篇文章主要介绍了mysql socket文件作用的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多