mysql 设置开机自启
时间: 2023-09-28 15:07:25 浏览: 64
在 Linux 系统中,可以使用以下步骤设置 MySQL 开机自启:
1. 打开终端或 SSH 客户端,以 root 身份登录系统。
2. 输入以下命令,安装 chkconfig 工具:
```
yum install chkconfig
```
3. 输入以下命令,设置 MySQL 开机自启:
```
chkconfig --level 2345 mysqld on
```
4. 输入以下命令,验证 MySQL 是否已经设置为开机自启动:
```
chkconfig --list mysqld
```
如果输出结果中包含 mysqld,且对应的 runlevel(运行级别)为 2、3、4、5,则表示 MySQL 已经成功设置为开机自启动。
注意:上述命令中的 mysqld 是 MySQL 服务的名称,如果您的 MySQL 服务名称不同,请将命令中的 mysqld 替换为正确的服务名称。
相关问题
mysql设置开机自启
在 Linux 中设置 MySQL 开机自启的步骤如下:
1. 登录系统。
2. 打开终端。
3. 输入以下命令:sudo chkconfig --add mysql。
4. 输入以下命令:sudo chkconfig mysql on。
5. 重启系统,检查 MySQL 是否开机自启。
如果你使用的是systemd管理服务可以这样:
1. 运行systemctl enable mysqld.service
2. 运行systemctl start mysqld.service
这样就可以让mysql开机自启动了。
centos7 设置mysql开机自启
在CentOS 7上设置MySQL开机自启可以通过以下步骤完成:
1. 首先,确保已经安装了MySQL数据库。如果没有安装,可以使用以下命令进行安装:
```
sudo yum install mysql-server
```
2. 安装完成后,启动MySQL服务:
```
sudo systemctl start mysqld
```
3. 接下来,设置MySQL服务开机自启:
```
sudo systemctl enable mysqld
```
4. 验证MySQL服务是否已经设置为开机自启:
```
sudo systemctl is-enabled mysqld
```
如果返回结果为"enabled",表示已经成功设置开机自启。
以上就是在CentOS 7上设置MySQL开机自启的步骤。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![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)