我正在运行 Ubuntu 20.4 服务器,最近删除了 mysql-server 和 mysql-client,并尝试启动并运行 MariaDB。我已经安装了 mariadb-server 和 mariadb-client。我停止并尝试重新启动 maria db。我收到一般错误消息:
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
然后我运行systenctl status mariadb.service
并得到以下内容:
mariadb.service - MariaDB 10.6.4 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Thu 2021-09-23 13:26:03 CDT; 8s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 97366 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 97377 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 97379 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] &&>
Process: 97387 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Main PID: 97387 (code=exited, status=1/FAILURE)
Sep 23 13:26:03 notised.xyz systemd[1]: Starting MariaDB 10.6.4 database server...
Sep 23 13:26:03 notised.xyz sh[97384]: [114B blob data]
Sep 23 13:26:03 notised.xyz sh[97384]: Fatal error in defaults handling. Program aborted
Sep 23 13:26:03 notised.xyz mariadbd[97387]: [106B blob data]
Sep 23 13:26:03 notised.xyz mariadbd[97387]: Fatal error in defaults handling. Program aborted
Sep 23 13:26:03 notised.xyz systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Sep 23 13:26:03 notised.xyz systemd[1]: mariadb.service: Failed with result 'exit-code'.
Sep 23 13:26:03 notised.xyz systemd[1]: Failed to start MariaDB 10.6.4 database server.
然后我运行journalctl -xd
并得到以下结果:
-- A start job for unit cloud-final.service has finished successfully.
--
-- The job identifier is 153.
Sep 23 14:16:57 notised.xyz systemd[1]: Reached target Cloud-init target.
-- Subject: A start job for unit cloud-init.target has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit cloud-init.target has finished successfully.
--
-- The job identifier is 148.
Sep 23 14:16:57 notised.xyz systemd[1]: Startup finished in 6.792s (kernel) + 2min 3.586s (userspace) = 2min 10.379s.
-- Subject: System start-up is now complete
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- All system services necessary queued for starting at boot have been
-- started. Note that this does not mean that the machine is now idle as services
-- might still be busy with completing start-up.
--
-- Kernel start-up required 6792915 microseconds.
--
-- Initial RAM disk start-up required INITRD_USEC microseconds.
--
-- Userspace start-up required 123586997 microseconds.
Sep 23 14:17:01 notised.xyz CRON[2544]: pam_unix(cron:session): session opened for user root by (uid=0)
Sep 23 14:17:01 notised.xyz CRON[2552]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Sep 23 14:17:01 notised.xyz CRON[2544]: pam_unix(cron:session): session closed for user root
Sep 23 14:17:10 notised.xyz kernel: [UFW BLOCK] IN=eno1 OUT= MAC=90:2b:34:56:57:f0:74:ac:b9:eb:12:94:08:00 SRC=192.168.1.16 DST=192.168.1.62 LEN=222 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=57572 DPT=5514 LEN=202
我在 UFW 上完全打开了端口 3306,所以不太确定为什么会显示 UFW BLOCK 错误。
我尝试清除与 mysql 和 mariadb 相关的所有内容并多次重新安装 mariadb,但遇到同样的问题。
答案1
好的,经过大量的处理之后,我最终完全删除/清除了 MariaDB 和 mysql 中的所有内容。
我跑了:
sudo apt purge mariadb* *mariadb mysql* *mysql
sudo apt autoremove
sudo apt update && sudo apt full-upgrade -y
sudo find / | grep mysql
然后我删除了 mysql 的所有剩余文件
sudo find / | grep mariadb
然后我删除了 mariadb 的所有剩余文件
sudo deluser --remove-home mysql
sudo delgroup mysql
这可能有点过头了,但我对此感到很沮丧。删除所有内容后,我回到 mysql 并安装了 mysql-server。这次能够顺利启动并运行。
我认为当我最初使用 mysql 而不是 MariaDB 时,符号链接可能存在问题,但在删除它并从头开始之后,我就能让它工作了。