How to recover a crashed mysql server - mysql

I have a Debian squeeze server that is supposed to run MySQL, but after a hard reboot it is having problems starting up. Attempting to start it using /etc/init.d/mysql start produces this snippet in syslog:
Oct 20 07:13:08 hyperion mysqld_safe: Starting mysqld daemon with databases from /var/lib/mysql
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 [Note] Plugin 'FEDERATED' is disabled.
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 InnoDB: Initializing buffer pool, size = 8.0M
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 InnoDB: Completed initialization of buffer pool
Oct 20 07:13:08 hyperion mysqld: InnoDB: The log sequence number in ibdata files does not match
Oct 20 07:13:08 hyperion mysqld: InnoDB: the log sequence number in the ib_logfiles!
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 InnoDB: Database was not shut down normally!
Oct 20 07:13:08 hyperion mysqld: InnoDB: Starting crash recovery.
Oct 20 07:13:08 hyperion mysqld: InnoDB: Reading tablespace information from the .ibd files...
Oct 20 07:13:08 hyperion mysqld: InnoDB: Restoring possible half-written data pages from the doublewrite
Oct 20 07:13:08 hyperion mysqld: InnoDB: buffer...
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 InnoDB: Started; log sequence number 0 150617369
Oct 20 07:13:08 hyperion mysqld: 151020 7:13:08 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'user'
After googling the error I found that I had to repair a table by starting the server, then from another terminal access it and run the following:
mysql> use mysql
mysql> repair table host use_frm;
mysql> exit
However, already at the use mysql command, I get this wall of text in my mysqld terminal:
151020 7:50:03 [Note] Plugin 'FEDERATED' is disabled.
151020 7:50:03 InnoDB: Initializing buffer pool, size = 8.0M
151020 7:50:03 InnoDB: Completed initialization of buffer pool
151020 7:50:03 InnoDB: Started; log sequence number 0 150617379
151020 7:50:03 [Note] mysqld: ready for connections.
Version: '5.1.63-0+squeeze1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Debian)
mysqld: malloc.c:3097: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
05:51:07 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=16777216
read_buffer_size=131072
max_used_connections=10
max_threads=151
thread_count=10
connection_count=10
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346521 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x7f98cdbcac30
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 = 7f98c59a7e88 thread_stack 0x30000
mysqld(my_print_stacktrace+0x29) [0x7f98ccc7a689]
mysqld(handle_fatal_signal+0x483) [0x7f98cca8ea53]
/lib/libpthread.so.0(+0xeff0) [0x7f98cc1e0ff0]
/lib/libc.so.6(gsignal+0x35) [0x7f98cac831b5]
/lib/libc.so.6(abort+0x180) [0x7f98cac85fc0]
/lib/libc.so.6(+0x71dda) [0x7f98cacc2dda]
/lib/libc.so.6(+0x74d2d) [0x7f98cacc5d2d]
/lib/libc.so.6(__libc_malloc+0x70) [0x7f98cacc7a30]
mysqld(my_malloc+0x32) [0x7f98ccc64372]
mysqld(alloc_root+0xd5) [0x7f98ccc64bc5]
mysqld(push_warning(THD*, MYSQL_ERROR::enum_warning_level, unsigned int, char const*)+0x194) [0x7f98cca14a84]
mysqld(my_message_sql+0x141) [0x7f98cc980c51]
mysqld(my_error+0xd8) [0x7f98ccc66118]
mysqld(open_table_def(THD*, st_table_share*, unsigned int)+0xeec) [0x7f98cc9dd95c]
mysqld(get_table_share(THD*, TABLE_LIST*, char*, unsigned int, unsigned int, int*)+0x230) [0x7f98cc9cbb00]
mysqld(+0x3c454b) [0x7f98cc9d254b]
mysqld(open_table(THD*, TABLE_LIST*, st_mem_root*, bool*, unsigned int)+0x7d5) [0x7f98cc9d3645]
mysqld(open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int)+0x6ee) [0x7f98cc9d437e]
mysqld(open_normal_and_derived_tables(THD*, TABLE_LIST*, unsigned int)+0x1e) [0x7f98cc9d451e]
mysqld(mysqld_list_fields(THD*, TABLE_LIST*, char const*)+0x20) [0x7f98ccab1f60]
mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x17f2) [0x7f98cc999a02]
mysqld(do_command(THD*)+0xea) [0x7f98cc999caa]
mysqld(handle_one_connection+0x236) [0x7f98cc98b796]
/lib/libpthread.so.0(+0x68ca) [0x7f98cc1d88ca]
/lib/libc.so.6(clone+0x6d) [0x7f98cad2092d]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f98cdbd5610):
Connection ID (thread ID): 16
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.
I tried posting for help on the official forums, but it seems the moderators did not let my post through. My debugging skills are too inferior to figure out what is wrong and how to salvage data from the databases. I have been able to start up the server momentarily by skipping grant tables, but when I try to dump the databases using mysqldump --all-databases > backup.sql I hit another error:
mysqldump: Error 1194: Table 'wp_options' is marked as crashed and should be repaired when dumping table `wp_options` at row: 111
Any help is appreciated.

Related

homebrew installed mysql#5.7 does not start

I had to move from mysql (8.0.29) to mysql#5.7. MySQL in its newest formula does not compile any longer on my machine, because the machine is running Mojave in order to have native Aperture support.
I installed mysql#5.7 and changed path in my .zshrc to point to the new /usr/local/opt/mysql#5.7/bin.
After this I am still unable to start MySQL. When I run brew services list, I get:
mysql#5.7 stopped USER ~/Library/LaunchAgents/homebrew.mxcl.mysql#5.7.plist
When I try to run /usr/local/opt/mysql/bin/mysqld_safe --datadir=/usr/local/var/mysql I get:
√ ~ % /usr/local/opt/mysql/bin/mysqld_safe --datadir=/usr/local/var/mysql
2022-10-07T17:06:21.6NZ mysqld_safe Logging to '/usr/local/var/mysql/MACHINE.DOMAIN.TLD.err'.
2022-10-07T17:06:21.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
/usr/local/opt/mysql/bin/mysqld_safe: line 199: 9704 Abort trap: 6 env MYSQLD_PARENT_PID=9530 nohup /usr/local/opt/mysql/bin/mysqld --basedir=/usr/local/opt/mysql --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/mysql/lib/plugin --log-error=MACHINE.DOMAIN.TLD.err --pid-file=mMACHINE.DOMAIN.TLD.pid < /dev/null >> /usr/local/var/mysql/MACHINE.DOMAIN.TLD.err 2>&1
2022-10-07T17:06:21.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/MACHINE.DOMAIN.TLD.pid ended
When I check the error log file MACHINE.DOMAIN.TLD.err, I get the following output:
key_buffer_size=8388608
read_buffer_size=131072
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 = 68222 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 0x40000
0 mysqld 0x0000000101a676a9 my_print_stacktrace + 58
1 mysqld 0x00000001019e5473 handle_fatal_signal + 698
2 libsystem_platform.dylib 0x00007fff6d0b6b5d _sigtramp + 29
3 ??? 0x0000000103ae5380 0x0 + 4356723584
4 libsystem_c.dylib 0x00007fff6cf706a6 abort + 127
5 mysqld 0x0000000101c568b9 _Z23ut_dbg_assertion_failedPKcS0_m + 161
6 mysqld 0x0000000101c5929b _ZN2ib5fatalD2Ev + 91
7 mysqld 0x0000000101c592d9 _ZN2ib5fatalD1Ev + 9
8 mysqld 0x0000000101affc6d _ZL18fil_node_open_fileP10fil_node_t + 2435
9 mysqld 0x0000000101b0946b _ZL23fil_node_prepare_for_ioP10fil_node_tP12fil_system_tP11fil_space_t + 191
10 mysqld 0x0000000101b09b71 _Z6fil_ioRK9IORequestbRK9page_id_tRK11page_size_tmmPvS8_ + 796
11 mysqld 0x0000000101ad0dfc _ZL17buf_read_page_lowP7dberr_tbmmRK9page_id_tRK11page_size_tb + 415
12 mysqld 0x0000000101ad0f53 _Z13buf_read_pageRK9page_id_tRK11page_size_t + 56
13 mysqld 0x0000000101abc5d4 _Z16buf_page_get_genRK9page_id_tRK11page_size_tmP11buf_block_tmPKcmP5mtr_tb + 971
14 mysqld 0x0000000101c464d4 _Z31trx_rseg_get_n_undo_tablespacesPm + 251
15 mysqld 0x0000000101c296ab _Z34innobase_start_or_create_for_mysqlv + 6608
16 mysqld 0x0000000101b589d3 _ZL13innobase_initPv + 3636
17 mysqld 0x00000001014cde2e _Z24ha_initialize_handlertonP13st_plugin_int + 78
18 mysqld 0x0000000101931b46 _ZL17plugin_initializeP13st_plugin_int + 81
19 mysqld 0x000000010193164a _Z40plugin_register_builtin_and_init_core_sePiPPc + 706
20 mysqld 0x00000001019da4e2 _Z11mysqld_mainiPPc + 2918
21 libdyld.dylib 0x00007fff6cecb3d5 start + 1
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.
2022-10-07T16:36:18.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/MACHINE.DOMAIN.TLD.pid ended
2022-10-07T16:36:28.6NZ mysqld_safe Logging to '/usr/local/var/mysql/MACHINE.DOMAIN.TLD.err'.
2022-10-07T16:36:28.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2022-10-07T16:36:29.201378Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2022-10-07T16:36:29.201633Z 0 [Note] /usr/local/opt/mysql#5.7/bin/mysqld (mysqld 5.7.39) starting as process 8643 ...
2022-10-07T16:36:29.205774Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2022-10-07T16:36:29.207723Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-10-07T16:36:29.207755Z 0 [Note] InnoDB: Uses event mutexes
2022-10-07T16:36:29.207775Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-10-07T16:36:29.207791Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2022-10-07T16:36:29.210674Z 0 [Note] InnoDB: Number of pools: 1
2022-10-07T16:36:29.210835Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-10-07T16:36:29.212601Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-10-07T16:36:29.224493Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-10-07T16:36:29.273548Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4000!
2022-10-07 18:36:29 0x110a1e5c0 InnoDB: Assertion failure in thread 4574012864 in file ut0ut.cc line 921
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.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
16:36:29 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.
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.
I really hope someone can point me into the right direction. Maybe you cannot switch your databases back to 5.7 from 8?
Update
When I delete my v8 DB and try to run mysqld --initialize I get:
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicuuc.70.dylib
Referenced from: /usr/local/bin/mysqld
Reason: image not found
zsh: abort mysqld --initialize
After restoring the whole /usr/local directory from Timemachine to a state before updating and upgrading Homebrew and its formulae, everything appears to be working again.
I do not know what caused my dysfunctional system. I suspect that, when I upgraded single formulae or when I installed a new formulae last week, something must have gone wrong.
The symptoms were, that single apps refused to run by complaining about the missing library /usr/local/opt/icu4c/lib/libicuuc.70.dylib. In fact icu4c had been upgraded to version 71.1.
Restoring the whole directory /usr/local returned all the apps, which I discovered as non working to a running state. I haven't run a brew update or brew upgrade yet.

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

I am trying to add an auto increment column to a mysql table as:
mysql> ALTER TABLE scraped_comments ADD row_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY;
There are about 15 million records in the table. The query runs for about one and a half hour and then ends with the error:
ERROR 2013 (HY000): Lost connection to MySQL server during query
I tried setting higher timeout values by editing /etc/mysql/mysql.conf.d/mysqld.cnf
wait_timeout = 31536000
interactive_timeout = 31536000
and then running the query again. However the error persisted. While the query was running, I thought the issue may be caused by less memory so I had htop open in another terminal but less than half of memory was being used.
I checked /var/log/mysql/error.log file and found following in that file:
...
InnoDB: ###### Diagnostic info printed to the standard error stream
2019-06-14T06:21:49.965496Z 0 [ERROR] [MY-012872] [InnoDB] Semaphore wait has lasted > 38632704 seconds. We intentionally crash the server because it appears to be hung.[FATAL] Semaphore wait has lasted > 600 seconds. We intentionally crash the server because it appears to be hung.
2019-06-14T06:21:49.965563Z 0 [ERROR] [MY-013183] [InnoDB] Assertion failure: ut0ut.cc:629 thread 140385843095296
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/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
06:21:49 UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
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 0x46000
/usr/sbin/mysqld(my_print_stacktrace(unsigned char*, unsigned long)+0x3d) [0x1dc2f5d]
/usr/sbin/mysqld(handle_fatal_signal+0x351) [0xeee441]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7fae50d4f390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7fae4f241428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7fae4f24302a]
/usr/sbin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x2db) [0x20736cb]
/usr/sbin/mysqld(ib::fatal::~fatal()+0x18e) [0x2075afe]
/usr/sbin/mysqld(srv_error_monitor_thread()+0xc07) [0x200ccf7]
/usr/sbin/mysqld(std::thread::_Impl<std::_Bind_simple<Runnable (void (*)())> >::_M_run()+0x63) [0x1e6e543]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xb8c80) [0x7fae4fbadc80]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7fae50d456ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7fae4f31341d]
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.
2019-06-14T06:21:53.867586Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 6199
2019-06-14T06:21:58.097227Z 0 [System] [MY-010229] [Server] Starting crash recovery...
2019-06-14T06:21:58.114311Z 0 [System] [MY-010232] [Server] Crash recovery finished.
2019-06-14T06:21:59.096291Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-06-14T06:21:59.225066Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.16' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
2019-06-14T06:21:59.436191Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
...
Thanks for the help
Came across
MySQL: InnoDb: Semaphore wait has lasted > 600 seconds. We intentionally crash the server
and increased thread_cache_size,innodb_buffer_pool_size and table_open_cache. I guess the issue was due to innodb_buffer_size as I first tried with innodb_buffer_size of 2 GB which didn't work. I then increased it to 3 GB and the query completed successfully

MySQL 5.6 not starting (migrate MAMP 2 to MAMP 4)

The old and the new MAMP: They don't boot MySQL server. Before the upgrade to MAMP 4, my MySQL server was working properly on OS X 10.11.6 El Capitan.
Now with MAMP is not possible to start the MySQL server (and migrate my old DB).
Note: "Tools > upgrade MySQL databases" is not accessible in the menu bar (remains gray) but no problem with Apache and PHP.
My chmod for all files from /Applications/MAMP/db/ is:
RW admin (group)
RW system
RW _mysql
RW _mysql (group)
RW everyone
and chmod for all files from /Applications/MAMP/tmp/mysql is:
RW admin (group)
RW system
RW everyone
MySQL last log error:
161007 12:20:26 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql56
2016-10-07 12:20:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-07 12:20:27 0 [Note] /Applications/MAMP/Library/bin/mysqld (mysqld 5.6.28) starting as process 16615 ...
2016-10-07 12:20:27 16615 [Warning] Setting lower_case_table_names=2 because file system for /Applications/MAMP/db/mysql56/ is case insensitive
2016-10-07 12:20:27 16615 [Note] Plugin 'FEDERATED' is disabled.
2016-10-07 12:20:27 16615 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-10-07 12:20:27 16615 [Note] InnoDB: The InnoDB memory heap is disabled
2016-10-07 12:20:27 16615 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-10-07 12:20:27 16615 [Note] InnoDB: Memory barrier is not used
2016-10-07 12:20:27 16615 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-10-07 12:20:27 16615 [Note] InnoDB: Using CPU crc32 instructions
2016-10-07 12:20:27 16615 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-10-07 12:20:27 16615 [Note] InnoDB: Completed initialization of buffer pool
2016-10-07 12:20:27 16615 [Note] InnoDB: Highest supported file format is Barracuda.
2016-10-07 12:20:27 16615 [Note] InnoDB: Log scan progressed past the checkpoint lsn 8276492
2016-10-07 12:20:27 16615 [Note] InnoDB: Database was not shutdown normally!
2016-10-07 12:20:27 16615 [Note] InnoDB: Starting crash recovery.
2016-10-07 12:20:27 16615 [Note] InnoDB: Reading tablespace information from the .ibd files...
2016-10-07 12:20:27 16615 [Note] InnoDB: Restoring possible half-written data pages
2016-10-07 12:20:27 16615 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 8280376
2016-10-07 12:20:27 16615 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
2016-10-07 12:20:27 16615 [Note] InnoDB: 128 rollback segment(s) are active.
2016-10-07 12:20:27 16615 [Note] InnoDB: Waiting for purge to start
2016-10-07 12:20:27 7000007ab000 InnoDB: Assertion failure in thread 123145310351360 in file dict0dict.cc line 3464
InnoDB: Failing assertion: for_table || ref_table
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.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
10:20:27 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=8388608
read_buffer_size=131072
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 = 68101 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 0x40000
0 mysqld 0x0000000106f73688 my_print_stacktrace + 72
1 mysqld 0x0000000106c3a9e8 handle_fatal_signal + 952
2 libsystem_platform.dylib 0x00007fff9fa7d52a _sigtramp + 26
3 ??? 0x020061d7b33d5471 0x0 + 144222767128859761
4 libsystem_c.dylib 0x00007fff9f4f66df abort + 129
5 mysqld 0x000000010700ba56 _Z25dict_foreign_add_to_cacheP14dict_foreign_tPPKcb17dict_err_ignore_t + 230
6 mysqld 0x0000000107026dba _ZL17dict_load_foreignPKcPS0_bb17dict_err_ignore_t + 1674
7 mysqld 0x000000010702601b _Z18dict_load_foreignsPKcPS0_bb17dict_err_ignore_t + 1115
8 mysqld 0x0000000107024996 _Z15dict_load_tablePKcm17dict_err_ignore_t + 2246
9 mysqld 0x0000000107026441 _Z21dict_load_table_on_idy17dict_err_ignore_t + 689
10 mysqld 0x0000000107004098 _ZL25dict_table_open_on_id_lowy17dict_err_ignore_t + 184
11 mysqld 0x0000000107003ee3 _Z21dict_table_open_on_idym15dict_table_op_t + 99
12 mysqld 0x000000010717dc75 _ZL24row_purge_parse_undo_recP12purge_node_tPhPbP9que_thr_t + 229
13 mysqld 0x000000010717d88f _ZL9row_purgeP12purge_node_tPhP9que_thr_t + 63
14 mysqld 0x000000010717d741 _Z14row_purge_stepP9que_thr_t + 305
15 mysqld 0x0000000107133d91 _ZL12que_thr_stepP9que_thr_t + 913
16 mysqld 0x00000001071334eb _ZL19que_run_threads_lowP9que_thr_t + 123
17 mysqld 0x00000001071332ee _Z15que_run_threadsP9que_thr_t + 110
18 mysqld 0x00000001071bc15a _Z9trx_purgemmb + 778
19 mysqld 0x00000001071aa673 _ZL12srv_do_purgemPm + 579
20 mysqld 0x00000001071a9be7 srv_purge_coordinator_thread + 679
21 libsystem_pthread.dylib 0x00007fff9328e99d _pthread_body + 131
22 libsystem_pthread.dylib 0x00007fff9328e91a _pthread_body + 0
23 libsystem_pthread.dylib 0x00007fff9328c351 thread_start + 13
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.
161007 12:20:27 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
I experienced the exact same problem and this is the only location (as of 10 Feb 2017) where I have found it reported as a problem.
If you don't need the content of the databases from MAMP 2, then this is easy:
Verify that MySQL is not running (via MAMP GUI and either Activity Monitor or Terminal process list)
Navigate to /Applications/MAMP/db/mysql56
Remove these three files: ib_logfile0, ib_logfile1, and ibdata1
Restart MySQL Server in MAMP
I found this solution here: http://www.randombugs.com/linux/crash-innodb-table.html. Note that the ibdata file is where InnoDB stores the data from your tables by default (https://serverfault.com/questions/487159/what-is-the-ibdata1-file-in-my-var-lib-mysql-directory) so it would be good to back-up these files before removing them; just in case something doesn't work out, you can restore back to your non-working configuration.
On the other hand, if you need the content of your MAMP 2 databases, then you will have needed to have completed a backup of them in the older/working version, preferably a MySQL dump so that restoration is as easy as copy/paste. Fortunately, I had a backup so in addition to deleting the "ib..." files listed above, I also deleted the directories of the databases that I intended to restore so that I could begin a restore with "CREATE DATABASE...".
I don't know whether this is a bug with MAMP, MySQL, OSX, but this is the solution that worked for me. I was able to restore the databases that I cared about and just didn't worry about losing the others for which I didn't have backed up.
Technical Data:
Old MAMP Version 2.1.2
Old MySQL Version 4.0.10.14
New MAMP Version 4.1.1
New MySQL Version 5.6.35
Mac OS 10.12.3

VPS Can't connect to local MySQL server through socket

the mysql in my VPS hosting has connection problem. I think it was due to my server drive has fail and my hosting has replace and rebuild a new drive. So I thought that my MySQL installation may have been corrupted, so I upgrade the mysql but the problem persist. How to fix this ? Thank you
root#user [~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.68-cll MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use testdb
No connection. Trying to reconnect...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
ERROR:
Can't connect to the server
mysql>
Here is the error log generated in /var/lib/mysql/domain.err
Version: '5.1.68-cll' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
130303 17:28:49 InnoDB: Assertion failure in thread 2965224304 in file fsp/fsp0fsp.c line 3341
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.
09:28:49 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=8384512
read_buffer_size=131072
max_used_connections=0
max_threads=500
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 = 1099543 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 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x25)[0x848d5e5]
/usr/sbin/mysqld(handle_fatal_signal+0x42a)[0x82dd84a]
[0xb775c500]
/lib/libc.so.6(abort+0x17a)[0xb75513da]
/usr/sbin/mysqld(fseg_free_step_not_header+0x1a1)[0x83afab1]
/usr/sbin/mysqld[0x8409078]
/usr/sbin/mysqld[0x84094d0]
/usr/sbin/mysqld(trx_purge_fetch_next_rec+0x7a)[0x840960a]
/usr/sbin/mysqld(row_purge_step+0x37)[0x83eefb7]
/usr/sbin/mysqld(que_run_threads+0x4f7)[0x83de467]
/usr/sbin/mysqld(trx_purge+0x32f)[0x840787f]
/usr/sbin/mysqld(srv_master_thread+0x417)[0x8400267]
/lib/libpthread.so.0(+0x6a49)[0xb773ca49]
/lib/libc.so.6(clone+0x5e)[0xb760763e]
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.
130303 17:28:49 mysqld_safe Number of processes running now: 0
130303 17:28:49 mysqld_safe mysqld restarted
130303 17:28:49 [Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead.
130303 17:28:49 [Warning] '--safe-show-database' is deprecated and will be removed in a future release. Please use 'GRANT SHOW DATABASES' instead.
130303 17:28:49 [Warning] '--log' is deprecated and will be removed in a future release. Please use ''--general_log'/'--general_log_file'' instead.
130303 17:28:49 [Note] Plugin 'FEDERATED' is disabled.
130303 17:28:49 InnoDB: Initializing buffer pool, size = 8.0M
130303 17:28:49 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!
130303 17:28:49 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...
130303 17:28:49 InnoDB: Started; log sequence number 0 1605434197
130303 17:28:49 [Warning] 'user' entry 'root#s1.replace.com' ignored in --skip-name-resolve mode.
130303 17:28:49 [Warning] 'user' entry 'root#xx1.no-ip.org' ignored in --skip-name-resolve mode.
130303 17:28:49 [Note] Event Scheduler: Loaded 0 events
130303 17:28:49 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.68-cll' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
130303 17:28:50 InnoDB: Assertion failure in thread 2965224304 in file fsp/fsp0fsp.c line 3341
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.
Computer info
root#user [~]# uname -a
Linux domain.com 2.6.32-042stab072.10 #1 SMP Wed Jan 16 18:54:05 MSK 2013 i686 i686 i386 GNU/Linux
root#user [~]# free -m
total used free shared buffers cached
Mem: 2560 1323 1236 0 0 826
-/+ buffers/cache: 497 2062
Swap: 0 0 0
root#user [~]# cat /etc/my.cnf
[mysqld]
max_connections=500
log-slow-queries
log-error
safe-show-database
bind-address=xx.x.xx.xxx
skip-name-resolve
connect_timeout= 10
log=1
log_warnings = 2
max_allowed_packet = 64M
Your MySQL server process either isn't running or the InnoDB assertion right after MySQL started listening for connections has hung the process. Note these lines:
130303 17:28:49 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.68-cll' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
130303 17:28:50 InnoDB: Assertion failure in thread 2965224304 in file fsp/fsp0fsp.c line 3341
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.
Go to the InnoDB Recovery page listed in that output and follow the instructions for forcing an InnoDB recovery. It looks like you have a corrupt InnoDB database.

MYSQL - Lost connection to MySQL server during query

Today i was trying to import a database(~650MB) which failed because of my max packet size was too small.. While trying to fix this, for some reason the database got corrupted.
Now i have the following problem:
In PhpMyAdmin i try to drop the table which is corrupted and it returns the following:
Fout
SQL-query:
DROP DATABASE `database_name`
MySQL retourneerde:
#2013 - Lost connection to MySQL server during query
Every single other database works fine, exept for this one.
I tried several ways, even by putting innodb_force_recovery to 6 in my.cnf file.
Does someone ever experienced something like this?
The FULL error output is:
Markering - 27 nov. 2012 16:49:06
121127 16:49:18 InnoDB: Assertion failure in thread 4516245504 in file dict0dict.c line 2643
InnoDB: Failing assertion: for_table || ref_table
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.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
15:49:18 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=16777216
read_buffer_size=262144
max_used_connections=1
max_threads=151
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 = 134066 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x1010c9000
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 = 10d306ed8 thread_stack 0x40000
0 mysqld 0x000000010027a4fc my_print_stacktrace + 44�
1 mysqld 0x0000000100021134 handle_fatal_signal + 692�
2 libsystem_c.dylib 0x00007fff836038ea _sigtramp + 26�
3 mysqld 0x00000001002efd87 mtr_memo_push + 23�
4 libsystem_c.dylib 0x00007fff8365adce abort + 143�
5 mysqld 0x00000001002baf96 dict_foreign_add_to_cache + 998�
6 mysqld 0x00000001002c09c6 dict_load_foreigns + 1414�
7 mysqld 0x00000001002c2b5b dict_load_table + 1707�
8 mysqld 0x00000001003212b1 row_drop_database_for_mysql + 129�
9 mysqld 0x000000010030b322 _ZL22innobase_drop_databaseP10handlertonPc + 226�
10 mysqld 0x0000000100022601 _ZL17dropdb_handlertonP3THDP13st_plugin_intPv + 33�
11 mysqld 0x0000000100178f7d _Z24plugin_foreach_with_maskP3THDPFcS0_P13st_plugin_intPvEijS3_ + 845�
12 mysqld 0x0000000100140de3 _Z11mysql_rm_dbP3THDPcbb + 1859�
13 mysqld 0x0000000100167143 _Z21mysql_execute_commandP3THD + 13491�
14 mysqld 0x000000010016a386 _Z11mysql_parseP3THDPcjP12Parser_state + 294�
15 mysqld 0x000000010016b49d _Z16dispatch_command19enum_server_commandP3THDPcj + 1709�
16 mysqld 0x000000010016c387 _Z10do_commandP3THD + 231�
17 mysqld 0x000000010020b581 _Z24do_handle_one_connectionP3THD + 353�
18 mysqld 0x000000010020b639 handle_one_connection + 73�
19 libsystem_c.dylib 0x00007fff83615742 _pthread_start + 327�
20 libsystem_c.dylib 0x00007fff83602181 thread_start + 13�
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (10e002810): is an invalid pointer
Connection ID (thread ID): 9
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.
121127 16:49:19 mysqld_safe mysqld restarted
121127 16:49:19 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
121127 16:49:19 [Note] Plugin 'FEDERATED' is disabled.
121127 16:49:19 InnoDB: The InnoDB memory heap is disabled
121127 16:49:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121127 16:49:19 InnoDB: Compressed tables use zlib 1.2.3
121127 16:49:19 InnoDB: Initializing buffer pool, size = 128.0M
121127 16:49:19 InnoDB: Completed initialization of buffer pool
121127 16:49:19 InnoDB: highest supported file format is Barracuda.
InnoDB: The user has set SRV_FORCE_NO_LOG_REDO on
InnoDB: Skipping log redo
121127 16:49:19 InnoDB: Waiting for the background threads to start
121127 16:49:20 InnoDB: 1.1.8 started; log sequence number 0
121127 16:49:20 InnoDB: !!! innodb_force_recovery is set to 6 !!!
121127 16:49:20 [Note] Event Scheduler: Loaded 0 events
121127 16:49:20 [Note] /Applications/MAMP/Library/bin/mysqld: ready for connections.
Version: '5.5.25' socket: '/Applications/MAMP/tmp/mysql/mysql.sock' port: 0 Source distribution
If you have tried each of the innodb_force_recovery values, (3 stops transactions being rolled back or forward), then I can only point you at the following
To cut to the chase, the person on this web page ended up deleteing the innodb files.
Until the end I don’t find a clear solution to this problem … but if you are on a testing environment you can just delete ibdata1 and ib_logfile0, ib_logfile1 and restart the server. This worked in my case.
http://www.randombugs.com/linux/crash-innodb-table.html
Obviously, if you have a load of other databases, this will involve backing up and restoring those aswell. If you find any other way around this, I suggest you try it first.
Percona provide a set of data recovery tools, but in your case the data is not the problem
http://code.google.com/p/innodb-tools/
https://launchpad.net/percona-data-recovery-tool-for-innodb