MySQL:ERROR 1286 (42000): Unknow

2020-05-20  本文已影响0人  重庆八怪

一、错误演示

如下:

root@localhost:test:09:49:03>create table ttt(id int) engine=myisam ;
ERROR 1286 (42000): Unknown storage engine 'MyISAM'

二、相关参数

我们环境中设置enforce_storage_engine为Innodb,sql_mode中设置了NO_ENGINE_SUBSTITUTION。

三、相关函数

部分逻辑如下:

  1. 根据ha_enforce_handlerton函数进行引擎检查,主要检查enforce_storage_engine参数设置的值是否为已知的引擎。否则报错 Unknown storage engine ,返回值为enforce_storage_engine指定的引擎(比如Innodb)。
  2. 根据上面的返回值进行判断

四、修改

注销掉enforce_storage_engine参数即可。

五、栈

#0  check_engine (thd=0x7fffe400a8a0, db_name=0x7fffe40108f0 "test", table_name=0x7fffe4010328 "ttt", create_info=0x7fffe8ecd890, alter_info=0x7fffe8ecd300)
    at /cdh/mysqldebug/percona-server-5.7.29-32/sql/sql_table.cc:11318
#1  0x000000000155d81e in create_table_impl (thd=0x7fffe400a8a0, db=0x7fffe40108f0 "test", table_name=0x7fffe4010328 "ttt", error_table_name=0x7fffe4010328 "ttt", 
    path=0x7fffe8eccf60 "./test/ttt", create_info=0x7fffe8ecd890, alter_info=0x7fffe8ecd300, internal_tmp_table=false, select_field_count=0, no_ha_table=false, is_trans=0x7fffe8ecd1ee, 
    key_info=0x7fffe8ecd170, key_count=0x7fffe8ecd16c) at /cdh/mysqldebug/percona-server-5.7.29-32/sql/sql_table.cc:5138
#2  0x000000000155f352 in mysql_create_table_no_lock (thd=0x7fffe400a8a0, db=0x7fffe40108f0 "test", table_name=0x7fffe4010328 "ttt", create_info=0x7fffe8ecd890, alter_info=0x7fffe8ecd300, 
    select_field_count=0, is_trans=0x7fffe8ecd1ee) at /cdh/mysqldebug/percona-server-5.7.29-32/sql/sql_table.cc:5753
#3  0x000000000155f47a in mysql_create_table (thd=0x7fffe400a8a0, create_table=0x7fffe4010368, create_info=0x7fffe8ecd890, alter_info=0x7fffe8ecd300)
    at /cdh/mysqldebug/percona-server-5.7.29-32/sql/sql_table.cc:5801
#4  0x00000000014cc36d in mysql_execute_command (thd=0x7fffe400a8a0, first_level=true) at /cdh/mysqldebug/percona-server-5.7.29-32/sql/sql_parse.cc:3510
#5  0x00000000014d2e1b in mysql_parse (thd=0x7fffe400a8a0, parser_state=0x7fffe8ece4a0, update_userstat=false) at /cdh/mysqldebug/percona-server-5.7.29-32/sql/sql_parse.cc:5927
#6  0x00000000014c7a55 in dispatch_command (thd=0x7fffe400a8a0, com_data=0x7fffe8ecec90, command=COM_QUERY) at /cdh/mysqldebug/percona-server-5.7.29-32/sql/sql_parse.cc:1539
#7  0x00000000014c688a in do_command (thd=0x7fffe400a8a0) at /cdh/mysqldebug/percona-server-5.7.29-32/sql/sql_parse.cc:1060
#8  0x00000000015fab28 in handle_connection (arg=0x3c4f150) at /cdh/mysqldebug/percona-server-5.7.29-32/sql/conn_handler/connection_handler_per_thread.cc:325
#9  0x00000000018cad34 in pfs_spawn_thread (arg=0x3c568b0) at /cdh/mysqldebug/percona-server-5.7.29-32/storage/perfschema/pfs.cc:2198
#10 0x00007ffff7bc6e65 in start_thread () from /lib64/libpthread.so.0
#11 0x00007ffff5fa088d in clone () from /lib64/libc.so.6

深入理解MySQL主从原理:https://www.jianshu.com/nb/43148932](https://www.jianshu.com/nb/43148932
个人微信:gaopp_22389860

上一篇下一篇

猜你喜欢

热点阅读