我以 root 身份登录,下面是我尝试启动服务时看到的内容。我已经删除并重新安装,我还运行了mysql_install_db。到目前为止我还无法解决这个问题。
law-amp3:/var/log # systemctl status mysql.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2021-11-09 14:02:10 CST; 14s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 7130 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper upgrade (code=exited, status=1/FAILURE)
Process: 7117 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install (code=exited, status=0/SUCCESS)
Nov 09 14:01:09 law-amp3 mysql-systemd-helper[7130]: Stale files from previous upgrade detected, cleaned them up
Nov 09 14:01:09 law-amp3 mysql-systemd-helper[7130]: Running protected MySQL...
Nov 09 14:01:09 law-amp3 mysql-systemd-helper[7130]: Waiting for MySQL to start
Nov 09 14:01:09 law-amp3 mysql-systemd-helper[7130]: 2021-11-09 14:01:09 0 [Note] /usr/sbin/mysqld (mysqld 10.4.17-MariaDB-log) starting as process 7154 ...
Nov 09 14:02:10 law-amp3 mysql-systemd-helper[7130]: MySQL is still dead
Nov 09 14:02:10 law-amp3 mysql-systemd-helper[7130]: MySQL didn't start, can't continue
Nov 09 14:02:10 law-amp3 systemd[1]: mariadb.service: Control process exited, code=exited status=1
Nov 09 14:02:10 law-amp3 systemd[1]: Failed to start MariaDB database server.
Nov 09 14:02:10 law-amp3 systemd[1]: mariadb.service: Unit entered failed state.
Nov 09 14:02:10 law-amp3 systemd[1]: mariadb.service: Failed with result 'exit-code'.
答案1
Bib 的以下内容对我有用:
删除玛丽亚服务器:
- 删除
/etc/my.cnf
和/var/lib/mysql
- 然后重新安装
这将擦除以前存在的所有旧数据库。似乎无法升级仍然存在的一个或多个。如果您需要,它们可以移动/var/lib/mysql
到其他位置并重新安装。
完成此操作后,我就可以启动 MariaDB。看来我的问题是my.cnf
文件中的 datadir 行导致它无法启动。