p1n3
V2EX  ›  Ubuntu

ubuntu 服务启动发生的怪事。。

  •  
  •   p1n3 · May 19, 2015 · 5524 views
    This topic created in 4194 days ago, the information mentioned may be changed or developed.
    root@Aspire-4752:/etc# service mysql restart
    stop:未知任务: mysql
    start:未知任务: mysql

    但是
    root@Aspire-4752:/etc# sudo service mysql restart
    mysql stop/waiting
    mysql start/running, process 8599

    我已经是root了,为什么还需要sudo呢??

    mysql 是这样安装的
    p1n3@Aspire-4752 ~ % sudo apt-get install mysql-server

    我真的纳闷了
    10 replies  •  2015-05-19 17:04:51 +08:00
    cevincheung
    cevincheung
    May 19, 2015
    1
    systemctl拯救世界
    choury
    choury
    May 19, 2015
    2
    直接mysqladmin shutdown 啊
    tan9le
    tan9le
    May 19, 2015❤️1
    3
    理论上是和/etc/sudoers里面的那个env_reset有关系
    参见手册: http://www.sudo.ws/man/1.8.13/sudoers.man.html
    tan9le
    tan9le
    May 19, 2015❤️1
    4
    正好有个ubuntu 14.04,我试验了一下,在以下方式切换到root的情况下是可以识别的:
    sudo su
    su -(注意有个横线)
    但是仅仅su的情况下,和你的问题一样
    请理解su 和 su -的区别,网上有很多,自行搜索一下吧
    Tiande
    Tiande
    May 19, 2015❤️1
    5
    ```
    sudo -E service mysql restart
    ```
    试一下。

    如果出现错误,证明你 bash 的 环境变量 有问题。

    另外观望答案中。
    p1n3
    p1n3
    OP
    May 19, 2015
    6
    @cevincheung
    好像ubuntu没有这个东西
    cevincheung
    cevincheung
    May 19, 2015
    7
    @p1n3 升vivid
    p1n3
    p1n3
    OP
    May 19, 2015
    8
    @tan9le
    和你说的一样,谢谢你!
    p1n3
    p1n3
    OP
    May 19, 2015
    9
    @dtdnqsb
    确实出现错误
    stop:未知任务: mysql
    start:未知任务: mysql
    p1n3
    p1n3
    OP
    May 19, 2015
    10
    @cevincheung
    还是不了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1807 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 16:07 · PVG 00:07 · LAX 08:07 · JFK 11:07
    ♥ Do have faith in what you're doing.