草庐IT

mysql - MAMP PRO崩溃; MySQL将不会在重新启动时启动

coder 2023-10-07 原文

今天,在工作中,我的计算机随机冻结/崩溃。重启后,MAMP拒绝启动mysql,我不知道为什么。肯定没有其他的mysql进程正在运行。我已经检查了几次。因此,killall -9 mysqld不是解决方案。我实际上也已经完全重新安装了MAMP。

这似乎是我的MySQL日志的重要组成部分,但是我对这些东西的阅读不是很熟练,所以也许答案就在我眼前。

140527 15:06:58 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
140527 15:06:58 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
140527 15:06:58 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
140527 15:06:58 [Note] Plugin 'FEDERATED' is disabled.
140527 15:06:58 InnoDB: The InnoDB memory heap is disabled
140527 15:06:58 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140527 15:06:58 InnoDB: Compressed tables use zlib 1.2.3
140527 15:06:58 InnoDB: Initializing buffer pool, size = 128.0M
140527 15:06:58 InnoDB: Completed initialization of buffer pool
140527 15:06:58 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 791075520
140527 15:06:58  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: Doing recovery: scanned up to log sequence number 791076717
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 8402.
InnoDB: You may have to recover from a backup.
140527 15:06:58  InnoDB: Page dump in ascii and hex (16384 bytes):
 len 16384; hex ....
InnoDB: End of page dump
140527 15:06:58  InnoDB: Page checksum 3802906200, prior-to-4.0.14-form checksum 786607151
InnoDB: stored checksum 3802906200, prior-to-4.0.14-form stored checksum 1787456768
InnoDB: Page lsn 0 791046088, low 4 bytes of lsn at page end 790720183
InnoDB: Page number (if stored to page already) 8402,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be an insert undo log page
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 8402.
InnoDB: You may have to recover from a backup.
InnoDB: It is also possible that your operating
InnoDB: system has corrupted its own file cache
InnoDB: and rebooting your computer removes the
InnoDB: error.
InnoDB: If the corrupt page is an index page
InnoDB: you can also try to fix the corruption
InnoDB: by dumping, dropping, and reimporting
InnoDB: the corrupt table. You can use CHECK
InnoDB: TABLE to scan your table for corruption.
InnoDB: See also http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
InnoDB: Ending processing because of a corrupt database page.
140527 15:06:58  InnoDB: Assertion failure in thread 140735261836048 in file buf0buf.c line 3619
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.
19:06:58 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=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 = 134084 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                              0x000000010028081c my_print_stacktrace + 44
1   mysqld                              0x0000000100021624 handle_fatal_signal + 692
2   libsystem_platform.dylib            0x00007fff91e625aa _sigtramp + 26
3   ???                                 0x0000000000000000 0x0 + 0
4   libsystem_c.dylib                   0x00007fff9355bb1a abort + 125
5   mysqld                              0x00000001002b30af buf_page_io_complete + 959
6   mysqld                              0x00000001002b9892 buf_read_page_low + 610
7   mysqld                              0x00000001002b9fa5 buf_read_page + 85
8   mysqld                              0x00000001002b4431 buf_page_get_gen + 673
9   mysqld                              0x000000010034fdd5 trx_undo_lists_init + 373
10  mysqld                              0x0000000100348e2e trx_rseg_mem_create + 334
11  mysqld                              0x0000000100348fed trx_rseg_list_and_array_init + 157
12  mysqld                              0x000000010034a147 trx_sys_init_at_db_start + 215
13  mysqld                              0x000000010033eafd innobase_start_or_create_for_mysql + 5805
14  mysqld                              0x00000001003114c1 _ZL13innobase_initPv + 1473
15  mysqld                              0x0000000100027028 _Z24ha_initialize_handlertonP13st_plugin_int + 104
16  mysqld                              0x000000010017f0f1 _ZL17plugin_initializeP13st_plugin_int + 97
17  mysqld                              0x0000000100181810 _Z11plugin_initPiPPci + 3776
18  mysqld                              0x00000001000ccce5 _Z11mysqld_mainiPPc + 10405
19  mysqld                              0x0000000100001804 start + 52
20  ???                                 0x000000000000000a 0x0 + 10
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.
140527 15:06:58 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

当尝试执行数据库转储时,我得到:(编辑:我已经修复了这部分)
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect

最佳答案

前言:这听起来很糟糕,但是在执行操作之前,请务必先阅读此答案中的所有内容。花费时间不能使事情变得更糟。阅读每个步骤,希望这将使您很清楚地了解并继续使用MAMP Pro中的MySQL数据库服务器并重新运行。

因此,您的InnoDB数据库似乎崩溃了。不是应用程序本身。密钥在这里在日志中:

140527 15:06:58 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 791075520
140527 15:06:58  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: Doing recovery: scanned up to log sequence number 791076717
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 8402.
InnoDB: You may have to recover from a backup.

好像您在这里使用MAMP PRO:
/Library/Application Support/appsolute/MAMP PRO/db/mysql

所以问题是,您是否有MAMP Pro数据库的备份?通过mysqldump还是其他?您的MAMP安装中是否还有其他InnoDB数据库?

另外,您说您能够运行mysqldump,但确实不可能数据库崩溃。因此,我假设当您运行mysqldump时,这是系统上另一种单独的MySQL安装。 MySQL二进制文件(例如MAMP或MAMP Pro中的mysqldump)与系统范围内的mysqldump不同。他们是两个100%不同的安装。您可以通过键入以下命令来检查正在使用的mysqldump:
which mysqldump

查看您所使用的内容的完整路径。 MAMP安装的mysqldump和其他相关二进制文件位于以下位置:
/Applications/MAMP/Library/bin/

而直接运行而不修改您的$PATH值(完全是另一回事)就是这样运行:
/Applications/MAMP/Library/bin/mysqldump

请仔细阅读:请注意,我在下面为您提供的建议是我以各种方式介绍应对这种情况的方法。如果InnoDB数据库不重要,请执行我的第一个建议,废弃InnoDB特定的DB文件。如果您有mysqldump备份,请执行相同的操作,但恢复mysqldump备份。

另外,InnoDB不是默认的存储引擎。您必须尽力设置它。默认值为MyISAM。在MySQL中创建的任何新数据库都将是MyISAM。因此,这将为您提供帮助。您需要考虑一下哪些数据库设置了InnoDB存储引擎。如果您说您有25个,但是只有1个拥有InnoDB,这是简单的解决方案。但是,如果您有25个数据库,则应养成定期进行mysqldump备份的习惯。如果您有备份,这将是一件令人头疼的事情,但很容易解决。

一项选择:删除损坏的InnoDB内容并从mysqldump备份中恢复。

如果您是我,我要做的第一件事就是备份mysql中的/Library/Application Support/appsolute/MAMP PRO/db/目录,以便您至少可以备份损坏的文件,以防万一。

然后,我将删除以下文件:
/Library/Application Support/appsolute/MAMP PRO/db/mysql/ib_logfile0
/Library/Application Support/appsolute/MAMP PRO/db/mysql/ib_logfile1
/Library/Application Support/appsolute/MAMP PRO/db/mysql/ibdata1

这些是InnoDB特定的文件。删除它们,然后尝试再次启动MAMP。它应该出现。但是,MAMP中的任何InnoDB数据库都将处于某种“僵尸”状态。您应该删除这些数据库并从备份中重新创建。或从头开始。

另一个选择:尝试使用innodb_force_recovery启动并重新运行MySQL服务器。

现在,您需要立即恢复该数据库,您可以按照此处所述运行尝试设置 innodb_force_recovery 的尝试。

对于MAMP Pro,看来您可以按照以下说明编辑MySQL配置文件:
  • 启动MAMP Pro。
  • 如果MAMP Pro服务器正在运行,请停止它。
  • 选择文件->编辑模板-> MySQL my.cnf
  • 出现一个编辑器窗口。
  • 如果出现警告消息,请单击“确定”确认。
  • 找到“[mysqld]”部分
  • 在本节的最后一行下面添加以下行:innodb_force_recovery = 1

  • 还有as the MySQL documentation explains,这严格是为了启动数据库并使其运行,因此您可以通过mysqldump进行备份:

    In such cases, use the innodb_force_recovery option to force the InnoDB storage engine to start up while preventing background operations from running, so that you can dump your tables.



    现在innodb_force_recovery大约有6个不同的值,但是您现在真的应该只尝试1。如果您想尝试6种,请按以下步骤进行:

    1 (SRV_FORCE_IGNORE_CORRUPT)

    Lets the server run even if it detects a corrupt page. Tries to make SELECT * FROM tbl_name jump over corrupt index records and pages, which helps in dumping tables.

    2 (SRV_FORCE_NO_BACKGROUND)

    Prevents the master thread and any purge threads from running. If a crash would occur during the purge operation, this recovery value prevents it.

    3 (SRV_FORCE_NO_TRX_UNDO)

    Does not run transaction rollbacks after crash recovery.

    4 (SRV_FORCE_NO_IBUF_MERGE)

    Prevents insert buffer merge operations. If they would cause a crash, does not do them. Does not calculate table statistics.

    5 (SRV_FORCE_NO_UNDO_LOG_SCAN)

    Does not look at undo logs when starting the database: InnoDB treats even incomplete transactions as committed.

    6 (SRV_FORCE_NO_LOG_REDO)

    Does not do the redo log roll-forward in connection with recovery.

    With this value, you might not be able to do queries other than a basic SELECT * FROM t, with no WHERE, ORDER BY, or other clauses. More complex queries could encounter corrupted data structures and fail.

    If corruption within the table data prevents you from dumping the entire table contents, a query with an ORDER BY primary_key DESC clause might be able to dump the portion of the table after the corrupted part.



    如果您碰巧要启动并运行数据库,然后可以执行mysqldump,那么恭喜您!你很清楚!最好的下一步是
  • 停止MySQL数据库服务器
  • 从MySQL配置中删除innodb_force_recovery选项,以便数据库服务器可以正常运行。
  • 重新启动MySQL数据库服务器。
  • 从服务器删除损坏的MySQL数据库(不要删除转储文件!这是您的备份!)
  • 创建一个要恢复的新数据库。
  • mysqldump备份导入到新数据库中。

  • 并且应该完成。

    关于mysql - MAMP PRO崩溃; MySQL将不会在重新启动时启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23898787/

    有关mysql - MAMP PRO崩溃; MySQL将不会在重新启动时启动的更多相关文章

    1. ruby - 检查 "command"的输出应该包含 NilClass 的意外崩溃 - 2

      为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar

    2. ruby - Highline 询问方法不会使用同一行 - 2

      设置:狂欢ruby1.9.2高线(1.6.13)描述:我已经相当习惯在其他一些项目中使用highline,但已经有几个月没有使用它了。现在,在Ruby1.9.2上全新安装时,它似乎不允许在同一行回答提示。所以以前我会看到类似的东西:require"highline/import"ask"Whatisyourfavoritecolor?"并得到:Whatisyourfavoritecolor?|现在我看到类似的东西:Whatisyourfavoritecolor?|竖线(|)符号是我的终端光标。知道为什么会发生这种变化吗? 最佳答案

    3. ruby - 如何在续集中重新加载表模式? - 2

      鉴于我有以下迁移:Sequel.migrationdoupdoalter_table:usersdoadd_column:is_admin,:default=>falseend#SequelrunsaDESCRIBEtablestatement,whenthemodelisloaded.#Atthispoint,itdoesnotknowthatusershaveais_adminflag.#Soitfails.@user=User.find(:email=>"admin@fancy-startup.example")@user.is_admin=true@user.save!ende

    4. ruby-on-rails - active_admin 目录中的常量警告重新声明 - 2

      我正在使用active_admin,我在Rails3应用程序的应用程序中有一个目录管理,其中包含模型和页面的声明。时不时地我也有一个类,当那个类有一个常量时,就像这样:classFooBAR="bar"end然后,我在每个必须在我的Rails应用程序中重新加载一些代码的请求中收到此警告:/Users/pupeno/helloworld/app/admin/billing.rb:12:warning:alreadyinitializedconstantBAR知道发生了什么以及如何避免这些警告吗? 最佳答案 在纯Ruby中:classA

    5. Ruby Readline 在向上箭头上使控制台崩溃 - 2

      当我在Rails控制台中按向上或向左箭头时,出现此错误:irb(main):001:0>/Users/me/.rvm/gems/ruby-2.0.0-p247/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in`blockin_rl_dispatch_subseq':invalidbytesequenceinUTF-8(ArgumentError)我使用rvm来管理我的ruby​​安装。我正在使用=>ruby-2.0.0-p247[x86_64]我使用bundle来管理我的gem,并且我有rb-readline(0.4.2)(人们推荐的最少

    6. ruby-on-rails - 项目升级后 Pow 不会更改 ruby​​ 版本 - 2

      我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby​​版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby​​版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘

    7. ruby-on-rails - 启动 Rails 服务器时 ImageMagick 的警告 - 2

      最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru

    8. ruby - 在 Ruby 中重新分配常量时抛出异常? - 2

      我早就知道Ruby中的“常量”(即大写的变量名)不是真正常量。与其他编程语言一样,对对象的引用是唯一存储在变量/常量中的东西。(侧边栏:Ruby确实具有“卡住”引用对象不被修改的功能,据我所知,许多其他语言都没有提供这种功能。)所以这是我的问题:当您将一个值重新分配给常量时,您会收到如下警告:>>FOO='bar'=>"bar">>FOO='baz'(irb):2:warning:alreadyinitializedconstantFOO=>"baz"有没有办法强制Ruby抛出异常而不是打印警告?很难弄清楚为什么有时会发生重新分配。 最佳答案

    9. UE4 源码阅读:从引擎启动到Receive Begin Play - 2

      一、引擎主循环UE版本:4.27一、引擎主循环的位置:Launch.cpp:GuardedMain函数二、、GuardedMain函数执行逻辑:1、EnginePreInit:加载大多数模块int32ErrorLevel=EnginePreInit(CmdLine);PreInit模块加载顺序:模块加载过程:(1)注册模块中定义的UObject,同时为每个类构造一个类默认对象(CDO,记录类的默认状态,作为模板用于子类实例创建)(2)调用模块的StartUpModule方法2、FEngineLoop::Init()1、检查Engine的配置文件找出使用了哪一个GameEngine类(UGame

    10. 使用canal同步MySQL数据到ES - 2

      文章目录一、概述简介原理模块二、配置Mysql使用版本环境要求1.操作系统2.mysql要求三、配置canal-server离线下载在线下载上传解压修改配置单机配置集群配置分库分表配置1.修改全局配置2.实例配置垂直分库水平分库3.修改group-instance.xml4.启动监听四、配置canal-adapter1修改启动配置2配置映射文件3启动ES数据同步查询所有订阅同步数据同步开关启动4.验证五、配置canal-admin一、概述简介canal是Alibaba旗下的一款开源项目,Java开发。基于数据库增量日志解析,提供增量数据订阅&消费。Git地址:https://github.co

    随机推荐