Manjaro MySQL - mariadb.service 無法啟動

Manjaro MySQL - mariadb.service 無法啟動

當嘗試使用 啟動 MariaDB 時systemctl status mariadb,我得到:

● mariadb.service - MariaDB 10.3.15 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since (date)
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 2512 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 2513 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 2521 ExecStart=/usr/bin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
 Main PID: 2521 (code=exited, status=1/FAILURE)
   Status: "Starting final batch to recover 13 pages from redo log"

[ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
[Note] Recovering after a crash using tc.log
[Note] Starting crash recovery...
[Note] Crash recovery finished.
[ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
[Note] Server socket created on IP: '::'.
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
mariadb.service: Main process exited, code=exited, status=1/FAILURE
mariadb.service: Failed with result 'exit-code'.
Failed to start MariaDB 10.3.15 database server.

在遵循了各種教程之後,我可能會讓情況變得更糟。我無法mysql再運行(在 的上下文中mysql < file.sql),因為它說mysql: command not found

我嘗試刪除、重新安裝 mariadb 並在其間重新啟動電腦;但我運氣不好。有任何想法嗎?

編輯:許多其他人似乎也遇到這個問題。我不知道接下來我還做了什麼,因為已經一年多了。我知道按照安裝指南拱門維基逐行頁面將保證正確安裝。頁面的格式讓我仔細閱讀了一些內容(重要的內容是小內容,可選的內容是粗體),但請確保您做得正確並且安裝應該有效。

答案1

我遇到了同樣的問題,我為我做了這個解決方案:

sudo rm -rf /var/lib/mysql
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo mysql_secure_installation

進而:

sudo systemctl restart mariadb

祝你好運!

相關內容