Failed to start mariadb.service: Unit mariadb.service not found.
时间: 2023-07-25 20:37:15 浏览: 241
MariaDB环境包,安装MariaDB出现错误:Failed to start mariadb.service: Unit not found。
这个错误提示表明系统没有找到 mariadb.service 这个服务单元,可能是因为 MariaDB 没有正确安装或者安装过程中出现了错误。你可以尝试重新安装 MariaDB 并检查是否出现错误。如果问题仍然存在,你可以尝试使用以下命令来手动启动 MariaDB 服务:
```
sudo systemctl start mysqld
```
如果服务启动成功,你可以使用以下命令来检查 MariaDB 服务的状态:
```
sudo systemctl status mysqld
```
如果服务运行正常,你应该能够看到类似于以下内容的输出:
```
● mysqld.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-09-15 09:30:45 UTC; 3s ago
Process: 296 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 268 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 295 (mysqld_safe)
CGroup: /system.slice/mysqld.service
├─295 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─505 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
Sep 15 09:30:44 centos-7-x64 systemd[1]: Starting MariaDB database server...
Sep 15 09:30:44 centos-7-x64 mysqld_safe[295]: 210915 09:30:44 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Sep 15 09:30:44 centos-7-x64 mysqld_safe[295]: 210915 09:30:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Sep 15 09:30:45 centos-7-x64 systemd[1]: Started MariaDB database server.
```
如果服务没有运行,你可以查看日志文件 /var/log/mariadb/mariadb.log 来查找问题并尝试解决它。
阅读全文