無法啟動 mysql - error.log 不斷寫入

無法啟動 mysql - error.log 不斷寫入

最近,我在 Ubuntu 伺服器上託管的網站開始顯示「建立資料庫連線時發生錯誤」。

連接到伺服器,看起來 mysql 正在不斷重新啟動(3 秒前、20 秒前等,每次我嘗試此命令):

sudo systemctl status mysql.service

 mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (start) since Fri 2023-09-15 14:31:16 UTC; 3s ago
    Process: 8351 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 8362 (mysqld)
     Status: "Server startup in progress"
      Tasks: 12 (limit: 4541)
     Memory: 318.8M
     CGroup: /system.slice/mysql.service
             └─8362 /usr/sbin/mysqld

我的 /var/log/mysql/error.log 檔案也在快速成長。它包含許多奇怪的字符,後跟文本,例如:

InnoDB: End of page dump
InnoDB: Page may be a transaction system page
2023-09-15T14:33:15.169775Z 1 [ERROR] [MY-011899] [InnoDB] [FATAL] Unable to read page [page id: space=0, page number=5] into the buffer pool after 100 attempts. The most probable cause of this error may be that the table has been corrupted. Or, the table was compressed with with an algorithm that is not supported by this instance. If it is not a decompress failure, you can try to fix this problem by using innodb_force_recovery. Please see http://dev.mysql.com/doc/refman/8.0/en/ for more details. Aborting...
2023-09-15T14:33:15.169807Z 1 [ERROR] [MY-013183] [InnoDB] Assertion failure: buf0buf.cc:4054:ib::fatal triggered thread 140275780638464
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.
2023-09-15T14:33:15Z UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
BuildID[sha1]=b0a6398207071378976beb42c50ef89be92e92db
Thread pointer: 0x5580f6f1c3f0
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 = 7f9480134be0 thread_stack 0x100000
/usr/sbin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x41) [0x5580f29d9e71]
/usr/sbin/mysqld(print_fatal_signal(int)+0x39b) [0x5580f184efab]
/usr/sbin/mysqld(my_server_abort()+0x76) [0x5580f184f0f6]
/usr/sbin/mysqld(my_abort()+0xe) [0x5580f29d3e0e]
/usr/sbin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x349) [0x5580f2c77929]
/usr/sbin/mysqld(ib::fatal::~fatal()+0xd5) [0x5580f2c7a165]
/usr/sbin/mysqld(Buf_fetch<Buf_fetch_normal>::read_page()+0x1aa) [0x5580f2ce2fba]
/usr/sbin/mysqld(Buf_fetch_normal::get(buf_block_t*&)+0x170) [0x5580f2ceec20]
/usr/sbin/mysqld(Buf_fetch<Buf_fetch_normal>::single_page()+0x59) [0x5580f2ceed09]
/usr/sbin/mysqld(buf_page_get_gen(page_id_t const&, page_size_t const&, unsigned long, buf_block_t*, Page_fetch, ut::Location, mtr_t*, bool)+0x1fa) [0x5580f2cf02ea]
/usr/sbin/mysqld(Double_write::get(mtr_t*)+0x56) [0x5580f2cf3c56]
/usr/sbin/mysqld(Double_write::init_v1(unsigned int&, unsigned int&)+0x11b) [0x5580f2cf8c1b]
/usr/sbin/mysqld(dblwr::v1::init()+0x1b) [0x5580f2cf8e2b]
/usr/sbin/mysqld(srv_start(bool)+0x1471) [0x5580f2c166a1]
/usr/sbin/mysqld(+0x2349496) [0x5580f2a1d496]
/usr/sbin/mysqld(dd::bootstrap::DDSE_dict_init(THD*, dict_init_mode_t, unsigned int)+0x9e) [0x5580f27564ae]
/usr/sbin/mysqld(dd::upgrade_57::do_pre_checks_and_initialize_dd(THD*)+0x1a9) [0x5580f29abf89]
/usr/sbin/mysqld(+0x1240896) [0x5580f1914896]
/usr/sbin/mysqld(+0x289d0fd) [0x5580f2f710fd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8609) [0x7f94a20cb609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f94a1c9c133]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 1
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.

我認為這個問題最初是由硬碟已滿引起的。我嘗試恢復伺服器的舊備份,但我最舊的備份似乎已經有問題。

我完全陷入困境,沒有解決方案。我現在可以嘗試什麼?

答案1

在 my.cnf [mysqld] 部分中,您需要一行

thread_cache_size=64

如果該部分中不存在該行,請新增至 [mysqld] 部分。

我們隨時為您提供協助。

相關內容