怎么解决MYSQL中的Errcode: 17 - File exists问题
本篇内容主要讲解“怎么解决MYSQL中的Errcode: 17 - File exists问题”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么解决MYSQL中的Errcode: 17 - File exists问题”吧。
现象:
执行show fields from a时报下面的错误
Error:Can'tcreate/writetofile'/tmp/#sql_419_0.MYI'(Errcode:17-Fileexists):SHOWFULLFIELDSFROM`a`
解决方法:
在/tmp下,把相关的#sql文件移除即可
重现:
[root@10-19-187-240tmp]#ll|grepsql-rw-r--r--1rootroot5314531月1019:55a.sqllrwxrwxrwx1rootroot251月918:14mysql.sock->/var/lib/mysql/mysql.sock-rw-rw----1mysqlmysql983041月2121:23test.ibd-rw-rw----1mysqlmysql71月2211:15t_myisam.MYD-rw-rw----1mysqlmysql10241月2211:15t_myisam.MYIshowfileds开始执行时:[root@10-19-187-240tmp]#ll|grepsql-rw-r--r--1rootroot5314531月1019:55a.sqllrwxrwxrwx1rootroot251月918:14mysql.sock->/var/lib/mysql/mysql.sock-rw-rw----1mysqlmysql02月1414:20#sql_5ec_0.MYD-rw-rw----1mysqlmysql10242月1414:20#sql_5ec_0.MYI-rw-rw----1mysqlmysql983041月2121:23test.ibd-rw-rw----1mysqlmysql71月2211:15t_myisam.MYD-rw-rw----1mysqlmysql10241月2211:15t_myisam.MYI[root@10-19-187-240tmp]#[root@10-19-187-240tmp]#[root@10-19-187-240tmp]#cp"#sql_5ec_0.MYD"~/[root@10-19-187-240tmp]#cp"#sql_5ec_0.MYI"~/showfilelds执行完成后:[root@10-19-187-240tmp]#ll|grepsql-rw-r--r--1rootroot5314531月1019:55a.sqllrwxrwxrwx1rootroot251月918:14mysql.sock->/var/lib/mysql/mysql.sock-rw-rw----1mysqlmysql983041月2121:23test.ibd-rw-rw----1mysqlmysql71月2211:15t_myisam.MYD-rw-rw----1mysqlmysql10241月2211:15t_myisam.MYI[root@10-19-187-240tmp]#[root@10-19-187-240tmp]#把原来的文件copy回来[root@10-19-187-240tmp]#cp~/"#sql_5ec_0.MYD"./[root@10-19-187-240tmp]#cp~/"#sql_5ec_0.MYI"./[root@10-19-187-240tmp]#ll总用量20532-rw-r--r--1rootroot5314531月1019:55a.sqldrwxr-xr-x6rootroot40961月1214:50data-rw-r--r--1rootroot203767941月1421:34data.ziplrwxrwxrwx1rootroot251月918:14mysql.sock->/var/lib/mysql/mysql.sock-rw-r-----1rootroot02月1414:21#sql_5ec_0.MYD-rw-r-----1rootroot10242月1414:21#sql_5ec_0.MYI-rw-rw----1mysqlmysql983041月2121:23test.ibd-rw-rw----1mysqlmysql71月2211:15t_myisam.MYD-rw-rw----1mysqlmysql10241月2211:15t_myisam.MYI
再次执行show fields
就可以重现上面的错误
调用过程:
#0fill_schema_table_by_open(thd=0x2293ee0,is_show_fields_or_keys=true,table=0x7fbed405c310,schema_table=0x1531980,orig_db_name=0x7fbf00dfea20,orig_table_name=0x7fbf00dfea10,open_tables_state_backup=0x7fbf00dfe8b0,can_deadlock=false)at/data/mysql-5.6.35/sql/sql_show.cc:3470#10x000000000084107einget_all_tables(thd=0x2293ee0,tables=0x7fbed4006090,cond=0x0)at/data/mysql-5.6.35/sql/sql_show.cc:4131#20x000000000084f655indo_fill_table(thd=0x2293ee0,table_list=0x7fbed4006090,join_table=0x7fbed4065358)at/data/mysql-5.6.35/sql/sql_show.cc:7433#30x000000000084fa2cinget_schema_tables_result(join=0x7fbed405aae0,executed_place=PROCESSED_BY_JOIN_EXEC)at/data/mysql-5.6.35/sql/sql_show.cc:7534#40x00000000008238c7inJOIN::prepare_result(this=0x7fbed405aae0,columns_list=0x7fbf00dfeda0)at/data/mysql-5.6.35/sql/sql_select.cc:822#50x00000000007c10efinJOIN::exec(this=0x7fbed405aae0)at/data/mysql-5.6.35/sql/sql_executor.cc:116#60x0000000000824408inmysql_execute_select(thd=0x2293ee0,select_lex=0x2296478,free_join=true)at/data/mysql-5.6.35/sql/sql_select.cc:1101#70x000000000082471finmysql_select(thd=0x2293ee0,tables=0x7fbed4006090,wild_num=0,fields=...,conds=0x0,order=0x2296640,group=0x2296578,having=0x0,select_options=2684619520,result=0x7fbed405aab8,unit=0x2295e30,select_lex=0x2296478)at/data/mysql-5.6.35/sql/sql_select.cc:1222#80x000000000082273binhandle_select(thd=0x2293ee0,result=0x7fbed405aab8,setup_tables_done_option=0)at/data/mysql-5.6.35/sql/sql_select.cc:110#90x00000000007fb93einexecute_sqlcom_select(thd=0x2293ee0,all_tables=0x7fbed4006090)at/data/mysql-5.6.35/sql/sql_parse.cc:5181#100x00000000007f4081inmysql_execute_command(thd=0x2293ee0)at/data/mysql-5.6.35/sql/sql_parse.cc:2689---Type<return>tocontinue,orq<return>toquit---#110x00000000007fe4bcinmysql_parse(thd=0x2293ee0,rawbuf=0x7fbed4005030"showfieldsfroma",length=18,parser_state=0x7fbf00e00670)at/data/mysql-5.6.35/sql/sql_parse.cc:6433#120x00000000007f0f7dindispatch_command(command=COM_QUERY,thd=0x2293ee0,packet=0x2368eb1"showfieldsfroma",packet_length=18)at/data/mysql-5.6.35/sql/sql_parse.cc:1372#130x00000000007eff56indo_command(thd=0x2293ee0)at/data/mysql-5.6.35/sql/sql_parse.cc:1039#140x00000000007b5f35indo_handle_one_connection(thd_arg=0x2293ee0)at/data/mysql-5.6.35/sql/sql_connect.cc:982#150x00000000007b5ccainhandle_one_connection(arg=0x2293ee0)at/data/mysql-5.6.35/sql/sql_connect.cc:899#160x0000000000b33da0inpfs_spawn_thread(arg=0x21e64c0)at/data/mysql-5.6.35/storage/perfschema/pfs.cc:1860#170x00007fbf2c56faa1instart_thread()from/lib64/libpthread.so.0#180x00007fbf2b2d8aadinclone()from/lib64/libc.so.6
经过一步步的查看,发现是在
create_tmp_table (thd=0x2293ee0, param=0x7fbed405a050,
fields=..., group=0x0, distinct=false,
save_sum_fields=false, select_options=2147752704,
rows_limit=18446744073709551615,
table_alias=0x7fbed4006088 "COLUMNS")
at /data/mysql-5.6.35/sql/http://sql_tmp_table.cc:455
生成的临时表。
实际上是查看了information_schema中的表
到此,相信大家对“怎么解决MYSQL中的Errcode: 17 - File exists问题”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。