簡體   English   中英

Icinga Mysql 遷移錯誤表在引擎中不存在

[英]Icinga Mysql migration error Table doesn't exist in engine

我嘗試將 icinga 更新到 2.9.1,為此我需要在 sql 數據庫上應用遷移。

遷移使用以下 sql 查詢:

2.9.0 遷移

CREATE TABLE `icingaweb_rememberme`(
    ->   id                int(10) unsigned NOT NULL AUTO_INCREMENT,
    ->   username          varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL,
    ->   passphrase        varchar(256) NOT NULL,
    ->   random_iv         varchar(24) NOT NULL,
    ->   http_user_agent   text NOT NULL,
    ->   expires_at        timestamp NULL DEFAULT NULL,
    ->   ctime             timestamp NULL DEFAULT NULL,
    ->   mtime             timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
    ->   PRIMARY KEY (id)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

2.9.1 遷移

ALTER TABLE `icingaweb_rememberme`
    ->     MODIFY random_iv varchar(32)  NOT NULL;

問題是,當我嘗試執行它時,我收到了沖突的錯誤消息

完整遷移日志

MariaDB [(none)]> use icingaweb2
Database changed
MariaDB [icingaweb2]> CREATE TABLE `icingaweb_rememberme`(
    ->   id                int(10) unsigned NOT NULL AUTO_INCREMENT,
    ->   username          varchar(254) COLLATE utf8mb4_unicode_ci NOT NULL,
    ->   passphrase        varchar(256) NOT NULL,
    ->   random_iv         varchar(24) NOT NULL,
    ->   http_user_agent   text NOT NULL,
    ->   expires_at        timestamp NULL DEFAULT NULL,
    ->   ctime             timestamp NULL DEFAULT NULL,
    ->   mtime             timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
    ->   PRIMARY KEY (id)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
ERROR 1050 (42S01): Table 'icingaweb_rememberme' already exists
MariaDB [icingaweb2]> ALTER TABLE `icingaweb_rememberme`
    ->     MODIFY random_iv varchar(32)  NOT NULL;
ERROR 1932 (42S02): Table 'icingaweb2.icingaweb_rememberme' doesn't exist in engine

Icinga 當前顯示此錯誤(類似於第二次遷移錯誤)

SQLSTATE[42S02]: Base table or view not found: 1932 Table 'icingaweb2.icingaweb_rememberme' doesn't exist in engine

問題

我如何應用遷移以便集合icingaweb2具有表icingaweb_rememberme

我找到了答案。

MySQL 數據庫創建了文件icingaweb_rememberme.idb但沒有相應的frm文件。

我刪除了icingaweb_rememberme TABLE,刪除了留在 MySQL 目錄中的.idb並使用單個命令重新創建了表(已經應用了第二次遷移)

這可能不是完整的答案,或者可能有更簡單的解決方案,但在這種情況下,這對我有用。

如果您計划刪除或刪除文件和表格,請記住進行備份

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM