免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8120 | 回复: 5
打印 上一主题 下一主题

在Linux下如何实现mysql的自启动 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-03-07 18:39 |只看该作者 |倒序浏览
在Linux下如何实现mysql的自启动

--------------------------------------------------------------------------------

手动加载mysql.server start和mysqld_saft --user=root &这两句是可以的。
但是如何使它开机就自启动?

论坛徽章:
0
2 [报告]
发表于 2006-03-07 19:48 |只看该作者
把mysql.serve 考备/etc/rc.d/rc.mysqld
然后编辑rc.M加上自动启动即可.

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2016-03-12 06:20:00
3 [报告]
发表于 2006-03-07 20:39 |只看该作者
copy the mysql.server to /etc/rc.d/init.d
then chkconfig --level 2345 mysql.server on

论坛徽章:
0
4 [报告]
发表于 2006-03-07 23:10 |只看该作者
原帖由 qlks 于 2006-3-7 20:39 发表
copy the mysql.server to /etc/rc.d/init.d
then chkconfig --level 2345 mysql.server on


试过
这个好像不行!
mysql启动好象非得/usr/local/mysql/bin/mysqld-safe --user=root &
这样才能启动!

mysql.server的脚本里面虽然支持 start,但是不先用“/usr/local/mysql/bin/mysqld-safe --user=root &”这句,MYSQL死活不启动!!

论坛徽章:
0
5 [报告]
发表于 2006-03-08 09:16 |只看该作者

试试这样做

8. 在Linux中开机自动启mysql
        1) #> cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
        2) #> chmod +x /etc/init.d/mysql
        3) #> chkconfig --add mysql
              某些Linux(not RHAS3)还需要这个命令: #> chkconfig --level 345 mysql on
        4) 将下面命令行append到文件 /etc/rc.local (/etc/rc.d/rc.local)
                /bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'

其实我只做第4步,开机后MySQL也能启动

论坛徽章:
0
6 [报告]
发表于 2006-03-08 09:53 |只看该作者
原帖由 mj923 于 2006-3-7 23:10 发表


试过
这个好像不行!
mysql启动好象非得/usr/local/mysql/bin/mysqld-safe --user=root &
这样才能启动!

mysql.server的脚本里面虽然支持 start,但是不先用“/usr/local/mysql/bin/mysqld-safe - ...

你肯定是刚开始就用root用户来起动的(--user=root),那只有在mysql.server里面把
      $bindir/safe_mysqld --datadir=$datadir --pid-file=$pid_file &
改为      $bindir/safe_mysqld --datadir=$datadir --user=root --pid-file=$pid_file &

再执行cp mysql.server /etc/init.d/mysql
chkconfig --add mysql
下次就应该可以了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP