I have a 5GB MySQL database called "tweets", from which I need to access the table "searchresults". But when I perform a query on it or create a dump, the MySQL Server (Running on Windows 10) crashes all the time with the same error at the same row.
For example, if I try to dump the database with the following command:
C:\xampp\mysql\bin>mysqldump.exe --user root --force tweets > D:\secondtry.sql
I get the following error message in the cmd.exe window with the exact same row over and over again:
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)
and in the mysql_error.log I receive the following message and the server shuts down:
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/>
So far I have tried :
- I set innodb_force_recovery in the my.ini to 1 and 6
- I used the parameters "--force", "--skip-extended-insert" and "--hex-blob" for the mysqldump.exe
- I used PHPMyAdmin, MySQLWorkbench and even tried the Microsoft SQL Migration Tool to convert the DataBase into a MSSQL database
- I increased the max_allowed_packet option in the my.ini
- I used an Hex Editor to find the corrupt row in the .idb file to delete it, but I could not find out what I have to delete
- Use my backup, but the error is already in there
- "Repair Table", but I get the following response "The storage engine for the table doesn't support repair"
- Rebuilt the table with "ALTER TABLE searchresults ENGINE = InnoDB;" but the error occurs during the rebuild.
- Setting the innodb_log_file_size parameter in the my.ini to the maximum of 4G throws the same error.
- Use a different computer
I am pretty sure that there is a corrupt dataset in row 5222907 or 5222908 and that is why the server crashes. It would be totally fine for me to lose one row, if I can access the rest of the data afterwards. I could even lose the first 5222908 rows. But when I can't delete the corrupt data. If I use the query
DELETE FROM searchresults LIMIT 5222908
The server crashes again.
I would be very thankful for any tips on this matter. The data is very important to me, because I need it for my Master Thesis, which is due very soon.
Thank you for your time and effort!
EDIT: This is my table structure (notice, there are no keys or indexes):
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
EDIT: I used an INSERT INTO like this:
SELECT id INTO OUTFILE 'C:/Temp/allCount.csv' FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM searchresults;
And depending on the column I select (id, retweetcount etc.) I get a different amount of rows. They are always lower than 5222907, but this means, the issue could still be something parameter related instead of a corruption error. What do you think? Do you know some additional parameters I could adjust in the mysql config?