linux下每次启动之后,都要手动去启动mysql,觉得比较麻烦,就把mysql设置为开机启动。

步骤如下:

1、cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql   将服务文件拷贝到init.d下,并重命名为mysql

linux设置mysql开机启动
2、chmod +x /etc/init.d/mysql    赋予可执行权限

linux设置mysql开机启动
3、chkconfig --add mysql        添加服务

linux设置mysql开机启动
4、chkconfig --list             显示服务列表

linux设置mysql开机启动

如果看到mysql的服务,并且3,4,5都是on的话则成功

如果是off,则键入chkconfig --level 345 mysql on

5、reboot重启电脑
6、netstat -na | grep 3306,如果看到有监听说明服务启动了

 

 

相关文章:

  • 2021-09-26
  • 2021-11-22
  • 2021-11-22
  • 2021-09-13
  • 2021-11-20
  • 2021-05-30
  • 2021-07-17
猜你喜欢
  • 2021-08-28
  • 2021-11-20
  • 2022-02-01
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
相关资源
相似解决方案