unix 启动mysql_MySQL在Ubuntu系统的三种自启动方法

MySQL在Ubuntu系统的三种自启动方法

1、、软件环境:

Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-32-generic x86_64)

MySQL 5.6.27 x64

2、方法一

最简单的方法是执行命令:

# update-rc.d mysql defaults

Adding system startup for /etc/init.d/mysql …

/etc/rc0.d/K20mysql -> ../init.d/mysql

/etc/rc1.d/K20mysql -> ../init.d/mysql

/etc/rc6.d/K20mysql -> ../init.d/mysql

/etc/rc2.d/S20mysql -> ../init.d/mysql

/etc/rc3.d/S20mysql -> ../init.d/mysql

/etc/rc4.d/S20mysql -> ../init.d/mysql

/etc/rc5.d/S20mysql -> ../init.d/mysql

注意:移除MySQL的开机服务可执行命令update-rc.d mysql remove

3、方法二

第二种方法是使用sysv-rc-conf工具,执行命令:

# apt-get install sysv-rc-conf

# sysv-rc-conf

打开了命令行方式的自启动服务管理界面:

6b3f261929ffe294ed090b09ea1297b3.png

用鼠标点击,也可以用键盘方向键定位,用空格键选择, “X”表示开启该服务。用Ctrl+N翻下一页,用Ctrl+P翻上一页,用Q退出。

也可以用命令:

# sysv-rc-conf –level 2345 mysql off

注意:Ubuntu系统中服务的运行级别

0 系统停机状态

1 单用户或系统维护状态

2~5 多用户状态

6 重新启动

4、方法三

第三种方法是使用chkconfig工具,执行命令:

# apt-get install chkconfig

# chkconfig mysql –list

mysql 0:off 1:off 2:off 3:off 4:off 5:off 6:off

如果mysqld没有在列表,那么用命令添加它:

# chkconfig add mysql

我们可以看到,mysqld本来就在列表中,所以这一步我们跳过。

使用命令设置开机启动:

# chkconfig –add mysql

# chkconfig mysql –list

mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

表示MySQL的开机自启动已经设置完成。

相关资源:Ztrans丹诚软件Z39.50客户端-其它工具类资源-CSDN文库

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年1月19日
下一篇 2021年1月19日

相关推荐