ERROR 2013 (HY000): Lost connection to MySQL server during query

The solution is simple but strange, if you copy your /var/lib/mysql directory to another server and think it will work, be sure to check if you have /var/log/mysql and binary log files.  If you do, the server will not work and will give you errors like below and crash without the proper log files.

UPDATE user SET password=password("newpass") WHERE user='root';
flush privileges;

ERROR 2013 (HY000): Lost connection to MySQL server during query

No connection. Trying to reconnect...
Connection id:    1
Current database: *** NONE ***

Database changed



/var/log/mysqld.log output:

As we can see it is crashing and also looking for non-existent logfiles.




170116  2:31:44  InnoDB: Started; log sequence number 4 1641421037
170116  2:31:44 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
170116  2:31:45  InnoDB: Assertion failure in thread 140102772668160 in file handler/ha_innodb.cc line 875
InnoDB: Failing assertion: cset == 0
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
07:31:45 UTC - mysqld got signal 6 ;
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.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

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

Thread pointer: 0x0
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...
stack_bottom = 0 thread_stack 0x20000
/usr/libexec/mysqld(my_print_stacktrace+0x29) [0x8509f9]
/usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a3f13]
/lib64/libpthread.so.0(+0xf7e0) [0x7f6c44f1c7e0]
/lib64/libc.so.6(gsignal+0x35) [0x7f6c435505e5]
/lib64/libc.so.6(abort+0x175) [0x7f6c43551dc5]
/usr/libexec/mysqld() [0x72d7ab]
/usr/libexec/mysqld(dict_mem_table_add_col+0x20e) [0x7605de]
/usr/libexec/mysqld(dict_load_table+0x99e) [0x75bf8e]
/usr/libexec/mysqld(dict_load_table_on_id+0x403) [0x75cd13]
/usr/libexec/mysqld(row_purge_step+0x39c) [0x7b360c]
/usr/libexec/mysqld(que_run_threads+0x55b) [0x7a255b]
/usr/libexec/mysqld(trx_purge+0x332) [0x7cc902]
/usr/libexec/mysqld(srv_master_thread+0x708) [0x7c5298]
/lib64/libpthread.so.0(+0x7aa1) [0x7f6c44f14aa1]
/lib64/libc.so.6(clone+0x6d) [0x7f6c43606aad]
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.
170116 02:31:45 mysqld_safe Number of processes running now: 0
170116 02:31:45 mysqld_safe mysqld restarted
170116  2:31:45 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
170116  2:31:45  InnoDB: Initializing buffer pool, size = 8.0M
170116  2:31:45  InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
170116  2:31:45  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: In a MySQL replication slave the last master binlog file
InnoDB: position 0 6823363, file name bin.000001
InnoDB: Last MySQL binlog file position 0 611287495, file name /var/log/mysql/bin.000118
170116  2:31:45  InnoDB: Started; log sequence number 4 1641421037
170116  2:31:45 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution

The solution

Make sure you copy /var/log/mysql as well.


Tags:

hy, mysql, server, querythe, var, lib, directory, binary, errors, update, user, password, quot, newpass, flush, privileges, query, reconnect, database, mysqld, output, crashing, existent, logfiles, innodb, sequence, usr, libexec, connections, socket, assertion, handler, ha_innodb, cc, failing, cset, intentionally, generate, submit, detailed, http, repeated, failures, crashes, startup, corruption, tablespace, refer, dev, refman, en, forcing, html, utc, libraries, linked, corrupt, improperly, misconfigured, malfunctioning, hardware, scrape, info, diagnose, key_buffer_size, read_buffer_size, max_used_connections, max_threads, thread_count, connection_count, sort_buffer_size, bytes, ok, decrease, variables, equation, pointer, attempting, backtrace, stack_bottom, thread_stack, my_print_stacktrace, handle_fatal_signal, libpthread, xf, libc, gsignal, abort, dc, ab, dict_mem_table_add_col, dict_load_table, bf, dict_load_table_on_id, row_purge_step, que_run_threads, trx_purge, srv_master_thread, aa, clone, aad, manual, contains, mysqld_safe, processes, restarted, locking, deprecated, external, initializing, buffer, completed, initialization, ibdata, ib_logfiles, ibd, restoring, doublewrite, replication, binlog, bin,

Latest Articles

  • How To Upgrade Debian 8,9,10 to Debian 12 Bookworm
  • Linux dhcp dhclient Mint Redhat Ubuntu Debian How To Use Local Domain DNS Server Instead of ISPs
  • Docker dockerd swarm high CPU usage cause solution
  • Docker Minimum Requirements/How Efficient is Docker? How Much Memory Does Dockerd Use?
  • qemu-nbd: Failed to set NBD socket solution qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
  • apache2 httpd apache server will not start [pid 22449:tid 139972160445760] AH00052: child pid 23248 exit signal Aborted (6) solution Mint Debian Ubuntu Redhat
  • How to use the FTDI USB serial cable to RJ45 adapter to connect to the console on Cisco/Juniper Switch Router Firewall in Linux Ubuntu Debian Redhat
  • How To Setup Python3 in Ubuntu Docker Image for AI Deep Learning
  • How to Configure NVIDIA GPUs with Docker on Ubuntu: A Comprehensive Guide for AI Deep Learning CUDA Solution
  • Linux Ubuntu Mint how to check nameservers when /etc/resolv.conf disabled solution
  • Docker cannot work on other overlayfs filesystems such as ecryptfs won't start overlayfs: filesystem on '/home/docker/overlay2/check-overlayfs-support130645871/upper' not supported as upperdir
  • Linux How To Access Original Contents of Directory Mounted Debian Mint CentOS Redhat Solution
  • ecryptfs how to manually encrypt your existing home directory or other directory
  • How to Reset CIPC Cisco IP Communicator for CME CUCM CallManager
  • Internet Explorer Cannot Download File "Your security settings do not allow for this file to be downloaded." Security Settings Solution
  • Linux How To Upgrade To The Latest Kernel Debian Mint Ubuntu
  • Firefox how to restore and backup saved passwords and history which files/location
  • Linux How To echo as root solution to use tee permission denied solution Ubuntu Debian Mint Redhat CentOS
  • Linux how to keep command line bash process running if you are disconnected or need to logout of SSH remotely
  • Linux swapping too much? How to check the swappiness and stop swapping