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

祝你好运!

相关内容