mysql.service unit not found
时间: 2023-08-29 15:13:39 浏览: 59
The error message "mysql.service unit not found" indicates that the MySQL service unit file is missing or has been deleted from your system.
To fix this issue, you can try reinstalling the MySQL package which should restore the missing unit file. You can do this by running the following command:
```
sudo apt-get install --reinstall mysql-server
```
Alternatively, you can create a new MySQL service unit file manually. To do this, create a new file called `mysql.service` in the `/etc/systemd/system/` directory and add the following contents:
```
[Unit]
Description=MySQL Server
After=network.target
[Service]
ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
[Install]
WantedBy=multi-user.target
```
After creating this file, reload the systemd daemon by running the following command:
```
sudo systemctl daemon-reload
```
Then start the MySQL service using the following command:
```
sudo systemctl start mysql
```
You can also enable the service to start automatically at boot time by running the following command:
```
sudo systemctl enable mysql
```
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)