尝试启动 mysql 服务器时,它返回退出代码 1。我以前在这个服务器上做过一百万次。在过去的一个月里没有弄乱服务器,mysql 突然停止了,我无法启动它。我的错误.log:
[Note] InnoDB: Using mutexes to ref count buffer pool pages
[Note] InnoDB: The InnoDB memory heap is disabled
[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
[Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
[Note] InnoDB: Compressed tables use zlib 1.2.8
[Note] InnoDB: Using Linux native AIO
[Note] InnoDB: Using SSE crc32 instructions
[Note] InnoDB: Initializing buffer pool, size = 128.0M
[Note] InnoDB: Completed initialization of buffer pool
[Note] InnoDB: Highest supported file format is Barracuda.
[Note] InnoDB: Starting crash recovery from checkpoint LSN=591771482442
Everything goes to ruin below this line.
[Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
InnoDB: Set innodb_force_recovery to ignore this error.
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[Note] Plugin 'FEEDBACK' is disabled.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
在我可以启动mysql服务器之前,我无法运行mysqldump
也无法mysql -u root
:
Got error: 2002: "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")" when trying to connect
我正在运行mariadb-server 10.1.23-9-deb9u1。
不确定这是否有效,但由于服务器无论如何都不起作用,所以请尝试以下操作:
重命名
logfile0
并logfile1
然后重新启动服务器。
在执行任何操作之前,请将整个mysql文件夹复制到另一个位置以防万一。
答案就在我面前:
InnoDB: Set innodb_force_recovery to ignore this error.
我在/etc/mysql/mariadb.conf.d/50-server.cnf
的 [mysqld] 子句之后设置了innodb_force_recovery = 1
(此文件可能非常取决于您的操作系统(。
我重新启动了它,它自己修复了。后来我取出innodb_force_recovery = 1
并重新启动,然后它工作得很好。
我学到了什么?对"自动修复"程序更有信心。我对他们的期望如此之低,因为我接触了Microsoft窗口。