"Icinga Mysql 遷移錯誤:引擎中缺少表格"
P粉358281574
P粉358281574 2023-09-01 19:15:34
0
1
458
<p>我尝试将icinga更新到2.9.1版本,并且为此需要在sql数据库上应用迁移。</p> <p>迁移使用以下sql查询:</p> <p>2.9.0迁移</p> <pre class="brush:php;toolbar:false;">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;</pre> <p>2.9.1迁移</p> <pre class="brush:php;toolbar:false;">ALTER TABLE `icingaweb_rememberme` -> MODIFY random_iv varchar(32) NOT NULL;</pre> <p><strong>问题</strong>是,当我尝试执行时,我得到了冲突的错误消息</p> <p><strong>完整的迁移日志</strong></p> <pre class="brush:php;toolbar:false;">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): 表'icingaweb_rememberme'已经存在 MariaDB [icingaweb2]> ALTER TABLE `icingaweb_rememberme` -> MODIFY random_iv varchar(32) NOT NULL; ERROR 1932 (42S02): 表'icingaweb2.icingaweb_rememberme'在引擎中不存在</pre> <p>Icinga当前显示此错误(类似于第二个迁移错误)</p> <pre class="brush:php;toolbar:false;">SQLSTATE[42S02]: 基表或视图不存在:1932 表'icingaweb2.icingaweb_rememberme'在引擎中不存在</pre> <p><strong>问题</strong></p> <p>我如何应用迁移,以便集合<code>icingaweb2</code>具有表<code>icingaweb_rememberme</code></p>
P粉358281574
P粉358281574

全部回覆(1)
P粉973899567

I found the anwser.

MySQL資料庫建立了一個名為icingaweb_rememberme.idb的文件,但沒有對應的frm文件。

我已經刪除了icingaweb_rememberme表,移除了在MySQL目錄中剩下的.idb文件,並使用單一命令重新建立了該表(已經應用了第二次遷移)。

這可能不是完整的答案,或者可能有更簡單的解決方案,但對我來說這是有效的。

如果您打算刪除或移除檔案和表,請記得備份

#
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!