Chinaunix

标题: 我想看下我机器上的Mysql是不是随机启动了 [打印本页]

作者: chinesedragon    时间: 2012-07-19 17:05
标题: 我想看下我机器上的Mysql是不是随机启动了
该怎么办呢?
作者: ulovko    时间: 2012-07-19 18:16
  1. chkconfig --list |grep mysql
复制代码

作者: chenyx    时间: 2012-07-19 18:19
chkconfig --list mysqld
这样就可以
作者: chinesedragon    时间: 2012-07-20 07:57
全部是OFF,是不是意味着没有启动呢
ulovko 发表于 2012-07-19 18:16

作者: ulovko    时间: 2012-07-20 07:59
本帖最后由 ulovko 于 2012-07-20 07:59 编辑

回复 4# chinesedragon


是意味着默认没有启动
About chkconfig:  http://linux.vbird.org/linux_basic/0560daemons.php#chkconfig
离线简体中文完整版本: http://bbs.chinaunix.net/thread-3757881-1-1.html
作者: chinesedragon    时间: 2012-07-20 08:04
谢谢推荐,其实我已经看过了,只是不太确定。我用的是Ubuntu,在关机时的屏幕看到了检测Mysql状态之类的语句,所以来此确认一下
ulovko 发表于 2012-07-20 07:59
回复 4# chinesedragon

作者: ulovko    时间: 2012-07-20 08:07
回复 6# chinesedragon


    虽然鸟哥写的是centos下面的操作 但是这玩意可以类比的! ^_^
作者: chinesedragon    时间: 2012-07-20 08:10
我明白的~~~~
ulovko 发表于 2012-07-20 08:07
回复 6# chinesedragon

作者: zongg    时间: 2012-07-20 08:46
如果是源码包安装的mysql   启动命令也有可能放在/etc/rc.local里.
作者: snow888    时间: 2012-07-20 23:13
ps -ef |grep mysqld 看看是否有 mysqld 进程。
作者: chinesedragon    时间: 2012-07-20 23:15
有,
  1. $ ps -ef | grep mysqld
  2. mysql     1276     1  0 20:54 ?        00:00:02 /usr/sbin/mysqld
  3. 1000      5182  4294  0 23:14 pts/0    00:00:00 grep --color=auto mysqld
复制代码
这是不是意味着Mysql已经启动了呢?
snow888 发表于 2012-07-20 23:13
ps -ef |grep mysqld 看看是否有 mysqld 进程。

作者: snow888    时间: 2012-07-20 23:50
回复 11# chinesedragon


    是的,这应该是启动了。
作者: chinesedragon    时间: 2012-07-21 07:57
可是我用chkconfig --list mysql查看的,
全是OFF啊
snow888 发表于 2012-07-20 23:50
回复 11# chinesedragon

作者: ulovko    时间: 2012-07-21 08:07
回复 13# chinesedragon


    因为阁下手动启动了 ^_^
作者: chinesedragon    时间: 2012-07-21 08:12
这个可以确实,没有
ulovko 发表于 2012-07-21 08:07
回复 13# chinesedragon

作者: chenyx    时间: 2012-07-21 08:21
/usr/sbin/mysqld,这个很奇怪啊,楼主的mysql是手工编译的?没有道理mysql安装到/usr/sbin下啊
作者: chinesedragon    时间: 2012-07-21 08:23
不是手工编译的,是用apt-get安装的啊
chenyx 发表于 2012-07-21 08:21
/usr/sbin/mysqld,这个很奇怪啊,楼主的mysql是手工编译的?没有道理mysql安装到/usr/sbin下啊

作者: chenyx    时间: 2012-07-21 08:27
ubuntu啊,你看下netstat -antlp | grep 3306,能看到端口侦听状态不
作者: chinesedragon    时间: 2012-07-21 08:34
  1. luoshupeng@MyWorldIsYou:~$ sudo netstat -antlp | grep 3306
  2. [sudo] password for luoshupeng:
  3. tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1235/mysqld     
  4. luoshupeng@MyWorldIsYou:~$ chkconfig --list | grep mysql
  5. mysql                     0:off  1:off  2:off  3:off  4:off  5:off  6:off
  6. luoshupeng@MyWorldIsYou:~$ ps -ef | grep mysqld
  7. mysql     1235     1  0 08:31 ?        00:00:00 /usr/sbin/mysqld
  8. 1000      2597  2450  0 08:33 pts/1    00:00:00 grep --color=auto mysqld
  9. luoshupeng@MyWorldIsYou:~$
复制代码
这个还真启动了
chenyx 发表于 2012-07-21 08:27
ubuntu啊,你看下netstat -antlp | grep 3306,能看到端口侦听状态不

作者: ulovko    时间: 2012-07-21 08:35
chinesedragon 发表于 2012-07-21 08:23
不是手工编译的,是用apt-get安装的啊


请问 apt-get  && aptitude 区别是什么?
作者: chinesedragon    时间: 2012-07-21 08:37
在我用来没有什么区别,不过据说apptitude可以更好的解决软件依赖关系
ulovko 发表于 2012-07-21 08:35
请问 apt-get  && aptitude 区别是什么?

作者: ulovko    时间: 2012-07-21 08:39
chinesedragon 发表于 2012-07-21 08:37
在我用来没有什么区别,不过据说apptitude可以更好的解决软件依赖关系


据我所知 aptitude功能更强大 apt-get已经out了 O_o
作者: chinesedragon    时间: 2012-07-21 08:42
哦是吗?我看不见得,它应该还没有强大到取代apt-get的地步。
因为现在Ubuntu和Debian都还是默认apt-get的,没有默认安装aptitude的。
另外在我使用过程中没有感觉到aptitude比apt-get强大多少
ulovko 发表于 2012-07-21 08:39
据我所知 aptitude功能更强大 apt-get已经out了 O_o

作者: chinesedragon    时间: 2012-07-21 08:44
http://bbs.chinaunix.net/thread-1923526-1-1.html
好像还是有问题的
ulovko 发表于 2012-07-21 08:39
据我所知 aptitude功能更强大 apt-get已经out了 O_o

作者: ulovko    时间: 2012-07-21 08:55
chinesedragon 发表于 2012-07-21 08:44
http://bbs.chinaunix.net/thread-1923526-1-1.html
好像还是有问题的

apt-get 有超级牛力
aptitude 没有超级牛力
--------------------------
apt-get 可以获取源码。aptitude不会
-----------------------------------------------
aptitude是可以作到比较干净的删除软件包,不过有时侯它会把一些它认为不需要的包给删掉,实际上可能还是需要这些包的。
-----
Aptitude is said to deal with dependencies better than apt-get. For example, say you install a package which automatically installs some library packages because it depends on them. When you remove this package with apt-get, it won't remove the libraries this package installed, although they aren't used anymore.

When you install that package with aptitude and remove it with aptitude, aptitude 'detects' that those library packages aren't used anymore and will therefore automatically remove thm.

I myself switched from apt-get to aptitude.
FROM:http://www.linuxquestions.org/qu ... vs-aptitude-363365/


http://bbs.chinaunix.net/thread-3751791-1-1.html  我安装debian的时候就默认有aptitude O_o
作者: chinesedragon    时间: 2012-07-21 08:58
回复 25# ulovko


    谁知道呢,我等小菜,这问题是闹不清楚的。
不过aptitude是后来才出来的,应该更好一些吧
作者: chinesedragon    时间: 2012-07-21 08:58
但我好像记得有人说两者最好 不要混用
chinesedragon 发表于 2012-07-21 08:58
回复 25# ulovko

作者: chinesedragon    时间: 2012-07-21 09:00
@chenyx@snow888@ulovko
  1.     luoshupeng@MyWorldIsYou:~$ sudo netstat -antlp | grep 3306
  2.     [sudo] password for luoshupeng:
  3.     tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1235/mysqld     
  4.     luoshupeng@MyWorldIsYou:~$ chkconfig --list | grep mysql
  5.     mysql                     0:off  1:off  2:off  3:off  4:off  5:off  6:off
  6.     luoshupeng@MyWorldIsYou:~$ ps -ef | grep mysqld
  7.     mysql     1235     1  0 08:31 ?        00:00:00 /usr/sbin/mysqld
  8.     1000      2597  2450  0 08:33 pts/1    00:00:00 grep --color=auto mysqld
  9.     luoshupeng@MyWorldIsYou:~$
复制代码
我的Mysql不能不管啊,呵呵
作者: chenyx    时间: 2012-07-21 10:08
ubuntu默认是update-rc.d管理服务的,你找下文档吧.
作者: chinesedragon    时间: 2012-07-21 10:42
用update-rc.d 也处理不了,
只能 编辑 /etc/init/mysql.conf把start on [234]改为start on [!0123456]了。
这样Mysql就不会启动了
chenyx 发表于 2012-07-21 10:08
ubuntu默认是update-rc.d管理服务的,你找下文档吧.

作者: snow888    时间: 2012-07-21 10:43
回复 13# chinesedragon


    chkconfig 只是检查是否是默认随系统同时启动。
作者: chinesedragon    时间: 2012-07-21 10:44
我知道啊,如果状态是OFF,不就是不启动了?
snow888 发表于 2012-07-21 10:43
回复 13# chinesedragon

作者: snow888    时间: 2012-07-21 10:46
回复 28# chinesedragon


    没明白,这个 mysql 不能不管是啥子意思啊。
作者: snow888    时间: 2012-07-21 10:47
回复 32# chinesedragon


    是不会随系统的启动而自动启动,但还是可以手动启动的。
作者: chenyx    时间: 2012-07-21 10:50
update-rc.d -f mysqld remove,这样应该可以吧.
作者: chinesedragon    时间: 2012-07-21 10:50
我是说这个问题不能不解决啊
snow888 发表于 2012-07-21 10:46
回复 28# chinesedragon

作者: chinesedragon    时间: 2012-07-21 10:51
我知道这个方法,但是我不想删除
chenyx 发表于 2012-07-21 10:50
update-rc.d -f mysqld remove,这样应该可以吧.

作者: chenyx    时间: 2012-07-21 10:52
你看下那个命令的帮助,看看有没有stop之类的参数.
作者: chinesedragon    时间: 2012-07-21 10:54
有Stop,但不起作用
chenyx 发表于 2012-07-21 10:52
你看下那个命令的帮助,看看有没有stop之类的参数.

作者: chenyx    时间: 2012-07-21 10:55
移除服务也不是删除服务,你照样可以手动运行服务的
作者: chenyx    时间: 2012-07-21 10:56
update那个,不影响运行的服务,只是让服务在下次启动的时候,不自动启动而已.想停止服务,运行/etc/init.d/mysqld stop关闭
作者: chinesedragon    时间: 2012-07-21 10:56
我明白,我用这个方法解决了
http://bbs.chinaunix.net/forum.p ... &fromuid=734114
chenyx 发表于 2012-07-21 10:55
移除服务也不是删除服务,你照样可以手动运行服务的

作者: chenyx    时间: 2012-07-21 10:59
那个只能算技巧吧,我一般用系统提供的工具来管理.

作者: snow888    时间: 2012-07-21 14:33
好像可以将 mysqld 服务加到系统服务里面的,这样一来,就可以让 mysqld 随系统启动而启动了。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2