我在启动 mysql(使用 mariadb)时遇到了一个大问题。
我的服务器崩溃了(并且没有转储服务器中的数据库。
恢复服务器后,我尝试手动将数据库从旧数据目录复制到新的数据目录。
但是当尝试访问数据库、生成转储或其他操作时,我收到消息说该表不存在。
经过查看,我意识到它与 InnoDB ib* 文件有关(我没有复制该文件)。
我在另一个分区上复制了我的“新”数据目录,然后将整个旧数据目录移到它的位置。
我使用服务命令重新启动了 mariadb,它说启动正常。
但当我尝试连接时,会出现错误Got error: 2002: "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")" when trying to connect
我决定查看错误是什么,并发出命令mysqld
查看启动过程并查看任何错误。
下面是输出。我不知道问题是什么。
$ mysqld
2017-05-09 22:45:15 140736651862976 [Note] mysqld (mysqld 10.1.23-MariaDB) starting as process 53227 ...
2017-05-09 22:45:15 140736651862976 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Using SSE crc32 instructions
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Completed initialization of buffer pool
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: The log sequence numbers 40443083550 and 40443083550 in ibdata files do not match the log sequence number 40443083788 in the ib_logfiles!
2017-05-09 22:45:31 140736651862976 [Note] InnoDB: Processed 3542 .ibd/.isl files
2017-05-09 22:45:34 140736651862976 [Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
2017-05-09 22:45:34 140736651862976 [Note] InnoDB: Read redo log up to LSN=40443084288
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
2017-05-09 22:45:34 140736651862976 [Note] InnoDB: Creating tablespace and datafile system tables.
2017-05-09 22:45:34 140736651862976 [ERROR] InnoDB: Creation of SYS_TABLESPACES and SYS_DATAFILES has failed with error 18. Tablespace is full. Dropping incompletely created tables.
2017-05-09 22:45:34 7fffce2423c0 InnoDB: Assertion failure in thread 140736651862976 in file dict0crea.cc line 1903
InnoDB: Failing assertion: err == DB_OUT_OF_FILE_SPACE || err == DB_TOO_MANY_CONCURRENT_TRXS
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.
170509 22:45:34 [ERROR] 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.
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
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.
Server version: 10.1.23-MariaDB
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=0
max_threads=153
thread_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467121 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 = 0x0 thread_stack 0x48400
0 mysqld 0x0000000105ed1304 my_print_stacktrace + 60
0 mysqld 0x00000001059cd5d8 handle_fatal_signal + 684
0 libsystem_platform.dylib 0x00007fffc54edb3a _sigtramp + 26
0 libsystem_notify.dylib 0x00007fffc54e7285 registration_node_release + 40
0 libsystem_c.dylib 0x00007fffc5372420 abort + 129
0 mysqld 0x0000000105d74d3a _Z40dict_create_add_tablespace_to_dictionarymPKcmS0_P5trx_tb + 0
0 mysqld 0x0000000105e8a956 _Z34innobase_start_or_create_for_mysqlv + 7160
0 mysqld 0x0000000105de07ed _ZL13innobase_initPv + 2996
0 mysqld 0x00000001059ce0df _Z24ha_initialize_handlertonP13st_plugin_int + 94
0 mysqld 0x0000000105b2d074 _ZL17plugin_initializeP11st_mem_rootP13st_plugin_intPiPPcb + 351
0 mysqld 0x0000000105b2cdba _Z11plugin_initPiPPci + 2881
0 mysqld 0x0000000105a74766 _ZL22init_server_componentsv + 1790
0 mysqld 0x0000000105a72c03 _Z11mysqld_mainiPPc + 9583
0 libdyld.dylib 0x00007fffc52de235 start + 1
0 ??? 0x0000000000000001 0x0 + 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.
[1] 53227 abort mysqld
$
回答亚历山大·T是的。
我将其添加到 my.cnf 中:
[mysqld]
innodb_force_recovery = 1
输出如下:
$ mysql.server start
Starting MySQL
170509 23:26:31 mysqld_safe Logging to '/usr/local/var/mysql/Alis-iMac.local.err'.
.170509 23:26:31 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
................................. ERROR!
$
该命令mysqld
也会出错。
这是尾巴:
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 = 0x0 thread_stack 0x48400
0 mysqld 0x000000010e787304 my_print_stacktrace + 60
0 mysqld 0x000000010e2835d8 handle_fatal_signal + 684
0 libsystem_platform.dylib 0x00007fffc54edb3a _sigtramp + 26
0 libsystem_notify.dylib 0x00007fffc54e7285 registration_node_release + 40
0 libsystem_c.dylib 0x00007fffc5372420 abort + 129
0 mysqld 0x000000010e62ad3a _Z40dict_create_add_tablespace_to_dictionarymPKcmS0_P5trx_tb + 0
0 mysqld 0x000000010e740956 _Z34innobase_start_or_create_for_mysqlv + 7160
0 mysqld 0x000000010e6967ed _ZL13innobase_initPv + 2996
0 mysqld 0x000000010e2840df _Z24ha_initialize_handlertonP13st_plugin_int + 94
0 mysqld 0x000000010e3e3074 _ZL17plugin_initializeP11st_mem_rootP13st_plugin_intPiPPcb + 351
0 mysqld 0x000000010e3e2dba _Z11plugin_initPiPPci + 2881
0 mysqld 0x000000010e32a766 _ZL22init_server_componentsv + 1790
0 mysqld 0x000000010e328c03 _Z11mysqld_mainiPPc + 9583
0 libdyld.dylib 0x00007fffc52de235 start + 1
0 ??? 0x0000000000000001 0x0 + 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.
[1] 53630 abort mysqld