Running this query:
SELECT * FROM information_schema.REFERENTIAL_CONSTRAINTS
kills all connections to the server.
If I add a condition like where table_name = 'some table'
it does not.
MySQL command line client gives this error:
ERROR 2013 (HY000): Lost connection to MySQL server during query
A jdbc-connected client gives this:
The last packet successfully received from the server was 766 milliseconds ago. The last packet sent successfully to the server was 724 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1121)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3603)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3492)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4043)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2809)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2758)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732)
at \\.\\.\\हिñçêČάй語简�?한\\.mꆯᜫꋱꐚassert.execute(Unknown Source)
at \\.\\.\\हिñçêČάй語简�?한\\.lꑰꋘꏇᠣpublicbreak.a(Unknown Source)
... 1 more
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3052)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3503)
... 11 more
Things I've tried that I thought sounded relevant based on other people's questions that seemed similar:
- grant all on . / flush privileges / restart
- installing a newer patch level of mysql
- repairing the table (it's more than just this one, but trying to repair gives the same error)
Any ideas on how to fix this?
Best Answer
It turns out there was some corrupt index.
First, I queried my server to find the log file location:
show variables like 'log_error'
Then I
tail -f /path/to/error_log
and ran the offending query again.It shows up in the logs like this:
In the interest of time, and because this happened to be an old database whose data could not have changed since the last backup I had, I just reimported its data, and that solved the issue.