服务器重启后如何自动启动mysql(CentOS +其他发行版)?


17

关闭服务器后,如何配置CentOS Linux服务器自动启动mysql?

我知道init.d的路径...

/etc/rc.d/init.d

...我可以在该文件夹中看到mysqld。我相信将项目(即通过符号链接)放置在此文件夹中意味着它们应在服务器重新启动时启动。

但这对我来说没有发生。

背景

我们的中央IT部门在周末重新启动了我们的虚拟化CentOS服务器。重新启动后服务器可用,但MySQL数据库也未重新启动。

有什么想法吗?


Answers:


30

使用chkconfig:

chkconfig --level 345 mysqld on

+1谢谢但是这应该是chkconfig --level 345 mysqld而不是chkconfig --levels 345 mysqld吗?linuxcommand.org/man_pages/chkconfig8.html我都尝试过。我猜测它的工作原理是没有任何消息或任何东西,键入后,我仅收到另一个提示。有什么方法可以告诉它是否使mysql自动重启?
— therobyouknow 2011年

2
@Rob:运行chkconfig --list mysqld以显示为初始化脚本设置的运行级别。
— Scott Pack

无法chkconfig安装....Package 'chkconfig' has no installation candidate
— inorganik
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.