MySQL崩溃("某些指针可能无效并导致转储中止")

时间:2016-06-02 18:36:47

标签: mysql database xampp corrupt

我有一个名为"推文"的5GB MySQL数据库,我需要从中访问该表" searchresults"。但是当我对它执行查询或创建转储时,MySQL服务器(在Windows 10上运行)会在同一行中以相同的错误一直崩溃。

例如,如果我尝试使用以下命令转储数据库:

C:\xampp\mysql\bin>mysqldump.exe --user root --force tweets > D:\secondtry.sql

我在cmd.exe窗口中得到以下错误消息,反复使用完全相同的行:

mysqldump.exe: Error 2013: Lost connection to MySQL server during query when dumping table `searchresults` at row: 5222907

mysqldump.exe: Couldn't execute 'SELECT engine FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'stats'': MySQL server has gone away (2006)

mysqldump.exe: Couldn't execute 'SET SQL_QUOTE_SHOW_CREATE=1': MySQL server has gone away (2006)

mysqldump.exe: Couldn't execute 'SELECT `COLUMN_NAME` AS `Field`, `COLUMN_TYPE` AS `Type`, `IS_NULLABLE` AS `Null`, `COLUMN_KEY` AS `Key`, `COLUMN_DEFAULT` AS `Default`, `EXTRA` AS `Extra`, `COLUMN_COMMENT` AS `Comment` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE TABLE_SCHEMA = 'tweets' AND TABLE_NAME = 'stats'': MySQL server has gone away (2006)

mysqldump.exe: Couldn't execute 'UNLOCK TABLES': MySQL server has gone away (2006)

并在mysql_error.log中收到以下消息,服务器关闭:

Server version: 10.1.8-MariaDB <br/> key_buffer_size=16777216 <br/> read_buffer_size=262144 <br/> max_used_connections=1 <br/>  max_threads=1001 <br/> thread_count=1 <br/> It is possible that mysqld could use up to <br/> key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = <br/> 787099 K  bytes of memory Hope that's ok; if not, decrease some <br/> variables in the equation. 

Thread pointer: 0x0x5b93168 <br/> Attempting backtrace. You can use the <br/> following information to find out where mysqld died. If you see no <br/> messages after this, something went terribly wrong... <br/> mysqld.exe!my_parameter_handler() <br/> mysqld.exe!my_mb_ctype_mb()<br/> mysqld.exe!??0Global_read_lock@@QAE@XZ()<br/> mysqld.exe!??0Global_read_lock@@QAE@XZ()<br/> mysqld.exe!?store_record_for_lookup@Stat_table@@IAEXXZ()<br/> mysqld.exe!??0Global_read_lock@@QAE@XZ()<br/> mysqld.exe!??0Global_read_lock@@QAE@XZ()<br/> mysqld.exe!??0Global_read_lock@@QAE@XZ()<br/> mysqld.exe!?store_record_for_lookup@Stat_table@@IAEXXZ()<br/> mysqld.exe!?store_record_for_lookup@Stat_table@@IAEXXZ()<br/> mysqld.exe!?ha_rnd_next@handler@@QAEHPAE@Z()<br/> mysqld.exe!?rr_sequential@@YAHPAUREAD_RECORD@@@Z()<br/> mysqld.exe!?sub_select@@YA? AW4enum_nested_loop_state@@PAVJOIN@@PAUst_join_table@@_N@Z() <br/> mysqld.exe!?setup_end_select_func@@YAP6A?AW4enum_nested_loop_state@@PAVJOIN@@PAUst_join_table@@_N@Z0@Z() <br/> mysqld.exe!?exec_inner@JOIN@@QAEXXZ() <br/> mysqld.exe!?exec@JOIN@@QAEXXZ()<br/> mysqld.exe!?handle_select@@YA_NPAVTHD@@PAULEX@@PAVselect_result@@K@Z()<br/> mysqld.exe!??0Table_scope_and_contents_source_st@@QAE@ABU0@@Z()<br/> mysqld.exe!?mysql_execute_command@@YAHPAVTHD@@@Z()<br/> mysqld.exe!?mysql_parse@@YAXPAVTHD@@PADIPAVParser_state@@@Z()<br/> mysqld.exe!?dispatch_command@@YA_NW4enum_server_command@@PAVTHD@@PADI@Z()<br/> mysqld.exe!?do_command@@YA_NPAVTHD@@@Z()<br/> mysqld.exe!?threadpool_process_request@@YAHPAVTHD@@@Z()<br/> mysqld.exe!?tp_end@@YAXXZ() <br/> KERNEL32.DLL!SetUserGeoID()<br/> ntdll.dll!TpSimpleTryPost() <br/> ntdll.dll!EtwNotificationRegister()<br/> KERNEL32.DLL!BaseThreadInitThunk()<br/> ntdll.dll!RtlUnicodeStringToInteger()<br/> ntdll.dll!RtlUnicodeStringToInteger()<br/>

Trying to get some variables. Some pointers may be invalid and cause<br/> the dump to abort. Query (0x5b9a908): SELECT /*!40001 SQL_NO_CACHE */<br/>
* FROM `searchresults`  <br/> Connection ID (thread ID): 2  <br/> Status: NOT_KILLED<br/>

到目前为止,我已经尝试过:

  1. 我将my.ini中的innodb_force_recovery设置为1和6
  2. 我使用了参数&#34; - force&#34;,&#34; - skip-extended-insert&#34;和&#34; - hex-blob&#34;对于mysqldump.exe
  3. 我使用了PHPMyAdmin,MySQLWorkbench,甚至尝试使用Microsoft SQL Migration Tool将DataBase转换为MSSQL数据库
  4. 我增加了my.ini
  5. 中的max_allowed_pa​​cket选项
  6. 我使用十六进制编辑器查找.idb文件中的损坏行以删除它,但我找不到我要删除的内容
  7. 使用我的备份,但错误已经在那里
  8. &#34;修复表&#34;,但我收到以下回复&#34;该表的存储引擎不支持修复&#34;
  9. 使用&#34; ALTER TABLE搜索结果重建表:ENGINE = InnoDB;&#34;但在重建期间发生错误。
  10. 将my.ini中的innodb_log_file_size参数设置为最大值为4G会引发相同的错误。
  11. 使用其他计算机
  12. 我很确定第5222907行或第5222908行中存在损坏的数据集,这就是服务器崩溃的原因。如果我之后可以访问其余的数据,那么丢失一行对我来说是完全没问题的。我甚至可能失去第一批5222908行。但是当我无法删除损坏的数据时。如果我使用查询

    DELETE FROM searchresults LIMIT 5222908
    

    服务器再次崩溃。

    我会非常感谢有关此事的任何提示。这些数据对我来说非常重要,因为我的硕士论文需要它,很快就会到期。

    感谢您的时间和精力!

    编辑:这是我的表结构(注意,没有键或索引):

    CREATE TABLE `searchresults` (
     `id` bigint(20) DEFAULT NULL,
     `user` varchar(50) CHARACTER SET latin1 DEFAULT NULL,
     `createdAt` timestamp NULL DEFAULT NULL,
     `retweetcount` int(11) DEFAULT NULL,
     `favoritecount` int(11) DEFAULT NULL,
     `message` varchar(500) CHARACTER SET latin1 DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
    
    编辑:我使用了INSERT INTO:

    SELECT id INTO OUTFILE 'C:/Temp/allCount.csv' FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM searchresults;
    

    根据我选择的列(id,retweetcount等),我获得了不同的行数。它们总是低于5222907,但这意味着,问题可能仍然是参数相关而不是损坏错误。你怎么看?你知道我可以在mysql配置中调整一些其他参数吗?

1 个答案:

答案 0 :(得分:0)

您可以考虑修改mysql服务器的这些属性:

nano /etc/mysql/my.cnf

query_cache_size=16M
key_buffer_size=256M

或者甚至可以尝试从mysql客户端增加查询的允许执行时间:

SET GLOBAL MAX_STATEMENT_TIME=1000;

在执行查询之前。