Linux系统mysql开机自启

原由:自己电脑上装了虚拟机,虚拟机上有装有MySQL数据库,因为电脑每天都要关机,第二天打开的时候还需要手动开启mysql服务,故做成自动启动。
步骤如下:
1,查看是否有mysql服务
[root@mysql1 ~]# chkconfig --list

2,进入mysql软件目录,复制mysql.server文件到 /etc/rc.d/init.d目录下
[root@mysql1 ~]# cd  /data/mysql/support-files
[root@mysql1 support-files]# cp  mysql.server  /etc/rc.d/init.d/mysql

3,给/etc/rc.d/init.d/mysql赋权可执行权限
[root@mysql1 support-files]# chmod  +x  /etc/rc.d/init.d/mysql

4,添加mysql服务
[root@mysql1 support-files]# chkconfig --add mysql

5,使mysql服务开机自启
[root@mysql1 support-files]# chkconfig --level 345 mysql on

6,reboot服务器,测试是否成功。


新闻标题:Linux系统mysql开机自启
文章转载:http://scyanting.com/article/gisceh.html