Giúp em lỗi không thể start mysql trên VPS ubuntu

Discussion in 'Hỏi Đáp Kỹ Thuật' started by chamchich, May 23, 2018.

  1. chamchich

    chamchich Sơ Nhập Giang Hồ

    Khởi động mysql nó báo như này:
    Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
     
  2. Hoa Mãn Lâu

    Hoa Mãn Lâu Trưởng Môn

    Gõ thử 2 cái lệnh
    systemctl status mysql.service
    journalctl -xe
    xem nó ra gì thím
     
  3. chamchich

    chamchich Sơ Nhập Giang Hồ

    Em quên add mất:
    Code:
    mysql.service - MySQL Community Server
       Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
       Active: activating (start-post) (Result: exit-code) since Wed 2018-05-23 02:09:37 UTC; 7s ago
      Process: 23989 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
      Process: 23981 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCES
    Main PID: 23989 (code=exited, status=1/FAILURE);         : 23990 (mysql-systemd-s)
        Tasks: 2
       Memory: 324.0K
          CPU: 348ms
       CGroup: /system.slice/mysql.service
               └─control
                 ├─23990 /bin/bash /usr/share/mysql/mysql-systemd-start post
                 └─24029 sleep 1
    
    May 23 02:09:37 vultr.guest systemd[1]: Starting MySQL Community Server...
    May 23 02:09:37 vultr.guest systemd[1]: mysql.service: Main process exited, code=exited, status=1/FA
    lines 1-16/16 (END)
    
    journalctl -xe nó ra:
    Code:
    May 23 02:10:08 vultr.guest audit[24087]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/24087/status" pid=24087 comm=
    May 23 02:10:08 vultr.guest kernel: audit: type=1400 audit(1527041408.100:351): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/
    May 23 02:10:08 vultr.guest kernel: audit: type=1400 audit(1527041408.100:352): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/
    May 23 02:10:08 vultr.guest systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
    May 23 02:10:38 vultr.guest systemd[1]: Failed to start MySQL Community Server.
    -- Subject: Unit mysql.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has failed.
    --
    -- The result is failed.
    May 23 02:10:38 vultr.guest systemd[1]: mysql.service: Unit entered failed state.
    May 23 02:10:38 vultr.guest systemd[1]: mysql.service: Failed with result 'exit-code'.
    May 23 02:10:38 vultr.guest systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
    May 23 02:10:38 vultr.guest systemd[1]: Stopped MySQL Community Server.
    -- Subject: Unit mysql.service has finished shutting down
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has finished shutting down.
    May 23 02:10:38 vultr.guest systemd[1]: Starting MySQL Community Server...
    -- Subject: Unit mysql.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has begun starting up.
    May 23 02:10:38 vultr.guest kernel: audit: type=1400 audit(1527041438.636:353): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/
    May 23 02:10:38 vultr.guest audit[24170]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/24170/status" pid=24170 comm=
    May 23 02:10:38 vultr.guest audit[24170]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=2417
    May 23 02:10:38 vultr.guest audit[24170]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/24170/status" pid=24170 comm=
    May 23 02:10:38 vultr.guest kernel: audit: type=1400 audit(1527041438.648:354): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/
    May 23 02:10:38 vultr.guest kernel: audit: type=1400 audit(1527041438.648:355): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/
    May 23 02:10:38 vultr.guest systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
    
     
  4. Boo Đẹp Trai

    Boo Đẹp Trai Tân Thủ Thôn

    Check mysql log xem thế nào :D
     
    chamchich likes this.
  5. thitgaluoc

    thitgaluoc Hương Chủ

  6. chamchich

    chamchich Sơ Nhập Giang Hồ

    Cảm ơn các bác, em đã fix xong lỗi này. Sáng qua mò mẫm nguyên buổi tìm không ra, chiều qua em đi nhậu tới tối. Sáng nay, cfe, chè xanh, tinh thần thoải mái ngồi tư duy xâu chuổi lại là do thằng apparmor. Em chia sẻ lên đây lỡ bác nào có gặp trường hợp này thì xử lý luôn ạ.
    Snapshot xong, chạy lệnh:
    Code:
    sudo service apparmor stop
    sudo service apparmor teardown
    sudo update-rc.d -f apparmor remove
    sudo reboot
    sudo apt-get remove apparmor
    
    Cài lại apparmor-profile:
    Code:
    sudo apt-get install apparmor-profiles
    
    Sau đó cài lại MySql Server và chạy thôi
    Code:
    sudo apt-get install mysql-server
    sudo service mysql start
    
     
    automan, Nai and Hoa Mãn Lâu like this.
  7. Hoa Mãn Lâu

    Hoa Mãn Lâu Trưởng Môn

    Quá ngon, Chủ thớt fix hay phết
     
    chamchich likes this.
  8. chamchich

    chamchich Sơ Nhập Giang Hồ

    Xếp quá khen, cho bóp zú cái nhoa!
     
  9. Hoa Mãn Lâu

    Hoa Mãn Lâu Trưởng Môn

    Vếu lép, ass dc hem {beauty}{beauty}{beauty}
     
  10. automan

    automan Hương Chủ

    vãi 2 ông {brick}
     
  11. chamchich

    chamchich Sơ Nhập Giang Hồ

    Chào thua, lầy hơn em nữa,...