如何理解ERROR中的Unknown storage engine 'MyISAM',相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
如下:
root@localhost:test:09:49:03>create table ttt(id int) engine=myisam ; ERROR 1286 (42000): Unknown storage engine 'MyISAM'
enforce_storage_engine:建表进行引擎检查,是否满足设置的引擎值。
sql_mode(NO_ENGINE_SUBSTITUTION):根据前面的检查值进行综合判断,如果设置了NO_ENGINE_SUBSTITUTION则进行报错,如果没有设置则进行,且将新建表的引擎转为enforce_storage_engine设置的引擎。
我们环境中设置enforce_storage_engine为Innodb,sql_mode中设置了NO_ENGINE_SUBSTITUTION。
check_engine
->ha_enforce_handlerton
部分逻辑如下:
根据ha_enforce_handlerton函数进行引擎检查,主要检查enforce_storage_engine参数设置的值是否为已知的引擎。否则报错 Unknown storage engine ,返回值为enforce_storage_engine指定的引擎(比如Innodb)。
根据上面的返回值进行判断
如果建表指定的引擎(比如这里的MyISAM)和enforce_storage_engine设置的引擎(比如这里的Innodb)不同,同时sql_mode设置了NO_ENGINE_SUBSTITUTION。则报错ERROR 1286 (42000): Unknown storage engine ‘MyISAM’,这也是当前的报错。
如果没有设置sql_mode NO_ENGINE_SUBSTITUTION,那么使用enforce_storage_engine指定的值代替建表语句的指定的引擎值(比如用Innodb代替MyISAM),同时报出警告,ER_WARN_USING_OTHER_HANDLER,输出为新的引擎值。
注销掉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
看完上述内容,你们掌握如何理解ERROR中的Unknown storage engine 'MyISAM'的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。