LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1235|回复: 2

重启系统之后每次必须手动启动MYSQL服务!!!!!!!!!

[复制链接]
发表于 2003-12-26 10:23:45 | 显示全部楼层 |阅读模式
我的MYSQL是编译包,我只要一关机再重启计算机,mysql服务就必须手动启动才能运行,每次都是这样,请问这是怎么回事呢?
发表于 2003-12-26 11:20:16 | 显示全部楼层
mysql manual
If you would like MySQL to start automatically when you boot your machine, you can copy support-files/mysql.server to the location where your system has its startup files. More information can be found in the support-files/mysql.server script itself and in section 2.4.3 Starting and Stopping MySQL Automatically.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.

You need to add these start and stop commands to the appropriate places in your `/etc/rc*' files when you want to start up MySQL automatically on your server.

On most current Linux distributions, it is sufficient to copy the file mysql.server into the `/etc/init.d' directory (or `/etc/rc.d/init.d' on older Red Hat systems). Afterwards, run the following command to enable the startup of MySQL on system bootup:

shell> chkconfig --add mysql.server

As an alternative to the above, some operating systems also use `/etc/rc.local' or `/etc/init.d/boot.local' to start additional services on bootup. To start up MySQL using this method, you could append something like the following to it:

/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &'

You can also add options for mysql.server in a global `/etc/my.cnf' file. A typical `/etc/my.cnf' file might look like this:

[mysqld]
datadir=/usr/local/mysql/var
socket=/var/tmp/mysql.sock
port=3306
user=mysql

[mysql_server]
basedir=/usr/local/mysql

The mysql.server script understands the following options: datadir, basedir, and pid-file.
发表于 2003-12-26 12:15:58 | 显示全部楼层
楼上的转的好详细哦。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表