1.环境
- Mac Os:
macOS 10.14.2 (18C54) - mysql:
mysql Ver 8.0.13 for osx10.14 on x86_64 (Homebrew)
2.现象
执行一个带有创建临时表的存储过程,0.367s左右就返回错误:
Error Code: 2013. Lost connection to MySQL server during query
3.过程
- 客户端设置:Workbench连接时间正常,而且直接用mysql命令行也出故障
- 参数查正,并无异常
>show variables like '%timeout%';
>show variables like 'max_allowed_packet'
- my.cnf 中添加skip-name-resolve,没用
- 把create table取消,直接返回结果,正常
- 换环境,docker拉一个mysql 8.0.13,同一结果。奇怪的是执行这个存错过程后容器关闭了!
- 查日志,发现痕迹,mysql崩溃了!
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7fc3e43fe428): create table tmp_trd_info as (
with tmp_new_pd_detail as (
SELECT
-- if(order_time_in < @dt, DATE_ADD(@dt, interval 1 second), order_time_in) t1,
......
Connection ID (thread ID): 8
Status: NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
2019-01-20T02:39:15.6NZ mysqld_safe mysqld restarted
看来create table 命令居然把MySQL搞垮了!
- 换建表引擎
create table tmp_trd_info ENGINE = MEMORY as ......
结果
ERROR 1163 (42000): The used table type doesn't support BLOB/TEXT columns
再换
create table tmp_trd_info ENGINE = myisam as ......
居然TNND好了!
4.结论
MySQL 8.0.13在存储过程中建立innodb的表会服务崩溃??深层次原因未知。