在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也能启动



QUOTE:
原帖由 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
下次就应该可以了。
posted on 2007-08-29 21:10  林宁  阅读(7431)  评论(0编辑  收藏  举报