2017-09-02 165 views
0

當我用兩個條件查詢時,mysql的崩潰,兩列都有索引。 它可以查詢每個條件。查詢多個條件時mysql崩潰

MySQL版本:MySQL的 - 19年7月5日 - winx64

操作系統:Windows 7旗艦版

任何人可以給出這個版本的一些建議嗎?

PS:是可以用my.ini解決問題嗎?

表:

mysql> create table firsttable(
-> id varchar(64), 
-> name varchar(64), 
-> flag char(1), 
-> primary key (id), 
-> key key_name (name), 
-> key key_flag (flag) 
-> ); 

插入數據:

mysql> insert into firsttable values(uuid(), 'test', '0'); 
Query OK, 1 row affected (0.10 sec) 
mysql> insert into firsttable values(uuid(), 'test1', '0'); 
Query OK, 1 row affected (0.10 sec) 

查詢:

mysql> select * from firsttable where name ='test'; 
+--------------------------------------+------+------+ 
| id         | name | flag | 
+--------------------------------------+------+------+ 
| d72bfd53-8fd6-11e7-baee-54ee7597a644 | test | 0 | 
+--------------------------------------+------+------+ 
1 row in set (0.00 sec) 

mysql> select * from firsttable where name ='test' and flag='0'; 
ERROR 2013 (HY000): Lost connection to MySQL server during query 
mysql> 

錯誤日誌:

2017-09-03T05:07:46.275435Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
 
2017-09-03T05:07:46.275435Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 
 
2017-09-03T05:07:46.275435Z 0 [Note] MySQL (mysqld 5.7.19) starting as process 8964 ... 
 
2017-09-03T05:07:46.283435Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 
 
2017-09-03T05:07:46.284435Z 0 [Note] InnoDB: Uses event mutexes 
 
2017-09-03T05:07:46.285436Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier 
 
2017-09-03T05:07:46.285436Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 
 
2017-09-03T05:07:46.286436Z 0 [Note] InnoDB: Number of pools: 1 
 
2017-09-03T05:07:46.287436Z 0 [Note] InnoDB: Not using CPU crc32 instructions 
 
2017-09-03T05:07:46.290436Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 
 
2017-09-03T05:07:46.298436Z 0 [Note] InnoDB: Completed initialization of buffer pool 
 
2017-09-03T05:07:46.448445Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 
 
2017-09-03T05:07:46.472446Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 2568065 
 
2017-09-03T05:07:46.473446Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 2568074 
 
2017-09-03T05:07:46.475446Z 0 [Note] InnoDB: Database was not shutdown normally! 
 
2017-09-03T05:07:46.476446Z 0 [Note] InnoDB: Starting crash recovery. 
 
2017-09-03T05:07:46.758463Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1" 
 
2017-09-03T05:07:46.760463Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 
 
2017-09-03T05:07:46.761463Z 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 
 
2017-09-03T05:07:46.939473Z 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB. 
 
2017-09-03T05:07:46.946473Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 
 
2017-09-03T05:07:46.950474Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 
 
2017-09-03T05:07:46.954474Z 0 [Note] InnoDB: Waiting for purge to start 
 
2017-09-03T05:07:47.012477Z 0 [Note] InnoDB: 5.7.19 started; log sequence number 2568074 
 
2017-09-03T05:07:47.014477Z 0 [Note] InnoDB: Loading buffer pool(s) from D:\Program Files\mysql-5.7.19-winx64\data\ib_buffer_pool 
 
2017-09-03T05:07:47.014477Z 0 [Note] Plugin 'FEDERATED' is disabled. 
 
2017-09-03T05:07:47.049479Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 
 
2017-09-03T05:07:47.052479Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 
 
2017-09-03T05:07:47.057480Z 0 [Note] IPv6 is available. 
 
2017-09-03T05:07:47.058480Z 0 [Note] - '::' resolves to '::'; 
 
2017-09-03T05:07:47.059480Z 0 [Note] Server socket created on IP: '::'. 
 
2017-09-03T05:07:47.322495Z 0 [Note] Event Scheduler: Loaded 0 events 
 
2017-09-03T05:07:47.323495Z 0 [Note] MySQL: ready for connections. 
 
Version: '5.7.19' socket: '' port: 3306 MySQL Community Server (GPL) 
 
2017-09-03T05:07:47.325495Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check. 
 
2017-09-03T05:07:47.327495Z 0 [Note] Beginning of list of non-natively partitioned tables 
 
2017-09-03T05:07:47.356497Z 0 [Note] End of list of non-natively partitioned tables 
 
2017-09-03T05:07:47.365497Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170903 13:07:47 
 
05:08:53 UTC - mysqld got exception 0xc000001d ; 
 
This could be because you hit a bug. It is also possible that this binary 
 
or one of the libraries it was linked against is corrupt, improperly built, 
 
or misconfigured. This error can also be caused by malfunctioning hardware. 
 
Attempting to collect some information that could help diagnose the problem. 
 
As this is a crash and something is definitely wrong, the information 
 
collection process might fail. 
 

 
key_buffer_size=8388608 
 
read_buffer_size=131072 
 
max_used_connections=1 
 
max_threads=200 
 
thread_count=1 
 
connection_count=1 
 
It is possible that mysqld could use up to 
 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 87423 K bytes of memory 
 
Hope that's ok; if not, decrease some variables in the equation. 
 

 
Thread pointer: 0x135e5400 
 
Attempting backtrace. You can use the following information to find out 
 
where mysqld died. If you see no messages after this, something went 
 
terribly wrong... 
 
7fef78e5c01 MSVCR120.dll!pow() 
 
13f5e5f7a mysqld.exe!get_sweep_read_cost()[handler.cc:7199] 
 
13fba7b37 mysqld.exe!ror_intersect_add()[opt_range.cc:5461] 
 
13fb9da89 mysqld.exe!get_best_ror_intersect()[opt_range.cc:5642] 
 
13fba9e25 mysqld.exe!test_quick_select()[opt_range.cc:3108] 
 
13f756a3e mysqld.exe!get_quick_record_count()[sql_optimizer.cc:5948] 
 
13f75549d mysqld.exe!JOIN::estimate_rowcount()[sql_optimizer.cc:5694] 
 
13f758209 mysqld.exe!JOIN::make_join_plan()[sql_optimizer.cc:5051] 
 
13f759d7b mysqld.exe!JOIN::optimize()[sql_optimizer.cc:368] 
 
13f7a2149 mysqld.exe!st_select_lex::optimize()[sql_select.cc:1009] 
 
13f7a016d mysqld.exe!handle_query()[sql_select.cc:164] 
 
13f613f17 mysqld.exe!execute_sqlcom_select()[sql_parse.cc:5158] 
 
13f615e46 mysqld.exe!mysql_execute_command()[sql_parse.cc:2795] 
 
13f6198a3 mysqld.exe!mysql_parse()[sql_parse.cc:5580] 
 
13f612953 mysqld.exe!dispatch_command()[sql_parse.cc:1464] 
 
13f61398a mysqld.exe!do_command()[sql_parse.cc:1001] 
 
13f5ba4dc mysqld.exe!handle_connection()[connection_handler_per_thread.cc:300] 
 
1400143a2 mysqld.exe!pfs_spawn_thread()[pfs.cc:2191] 
 
13fd2743c mysqld.exe!win_thread_start()[my_thread.c:38] 
 
7fef7874f7f MSVCR120.dll!_beginthreadex() 
 
7fef7875126 MSVCR120.dll!_endthreadex() 
 
7729f56d kernel32.dll!BaseThreadInitThunk() 
 
774d3281 ntdll.dll!RtlUserThreadStart() 
 

 
Trying to get some variables. 
 
Some pointers may be invalid and cause the dump to abort. 
 
Query (135700a0): select * from firsttable where name ='test' and flag='0' 
 
Connection ID (thread ID): 3 
 
Status: NOT_KILLED 
 

 
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains 
 
information that should help you find out what is causing the crash.

+0

Duplicate https://stackoverflow.com/questions/41476778/mysql-crash-when-querying? – BitAccesser

+0

我看到了問題,他說更新贏了10,解決了這個問題,但是我仍然想用win 7,感謝您的編輯。 –

+0

不,他說更新到Service Pack 1解決了這個問題。您需要更新到Win7 SP1。 – BitAccesser

回答

1

我試圖重現錯誤,我沒有得到的錯誤,讓我愛不釋手:

mysql> create table firsttable 
    -> (
    -> id varchar(64), 
    -> name varchar(64), 
    -> flag char(1), 
    -> primary key(id), 
    -> key key_name (name), 
    -> key key_flag (flag) 
    ->); 
Query OK, 0 rows affected (1.12 sec) 

mysql> insert into firsttable values(uuid(), 'test', '0'); 
Query OK, 1 row affected (0.20 sec) 

mysql> insert into firsttable values(uuid(), 'test1', '0'); 
Query OK, 1 row affected (0.08 sec) 

mysql> select * from firsttable where name ='test'; 
+--------------------------------------+------+------+ 
| id         | name | flag | 
+--------------------------------------+------+------+ 
| 7c89e986-9000-11e7-a1f8-507b9dc06264 | test | 0 | 
+--------------------------------------+------+------+ 
1 row in set (0.09 sec) 

mysql> select * from firsttable where name ='test' and flag='0'; 
+--------------------------------------+------+------+ 
| id         | name | flag | 
+--------------------------------------+------+------+ 
| 7c89e986-9000-11e7-a1f8-507b9dc06264 | test | 0 | 
+--------------------------------------+------+------+ 
1 row in set (0.09 sec) 

mysql> 

我可以斷定,MySQL crash是不是由於這個SQL語句。從錯誤日誌看來,MSVCR120.dll存在一些問題。爲了進一步分析,請分享完整的錯誤日誌。通常腐敗聲明將在KILL signal之前被捕獲。我希望這會對你有所幫助。謝謝!

+0

我編輯了問題併發布了完整的錯誤日誌。謝謝。 –

+0

更新到Win7 SP1解決了這個問題。在BitAccesser的幫助下,我沒有仔細看過其他類似的問題。 –

1

嘗試重新安裝x64的VC可再發行組件。 Download vcredist_x64.exe

+0

我重新安裝了x64的vc redistributables(2010,2013),但它不起作用。 –

+0

更新到Win7 SP1解決了這個問題。在BitAccesser的幫助下,我沒有仔細看過其他類似的問題。 –