mysql sql执行错误#1436 Thread stack overrun

1、mysql调用存储过程 call proc1() 时报错:

Thread stack overrun: 6656 bytes used of a 8496 byte stack, and 128000 bytes needed. Use 'mysqld --thread_stack=#' to specify a bigger stack.

2、错误原因:

thread_stack太小,默认 128K。

3、解决方法:

windows:在这个文件中my-small.ini thread_stack 建议调整到500K

linux:在my.cnf中配置thread_stack的值可解决此问题。一般可配置为256K。

在my.cnf的[mysqld]小节中加入下面的配置:

thread_stack=256K

保存,重启mysql服务即可。

4、查看配置是否生效

进入mysql命令环境中,用以下命令进行查看:

show variables like '%thread%';

mysql会显示出相应的配置参数,确定thread_stack项的value是否为期望值。