Job for mysqld.service failed See “systemctl status mysqld.service , journalctl -xe & tail -30 /var/log/mysql/error.log "

August 23, 2017 76.8k views
MySQL WordPress Ubuntu 16.04

I don’t know what i have to do now seeing this error(mysql.service won’t start) bcz i’m that much linux guy.....
Pls give some solution asap

systemctl status mysqld.service

● 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 2017-08-23 19:17:34 UTC; 24s ago
  Process: 26606 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 26597 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 26606 (code=exited, status=1/FAILURE);         : 26607 (mysql-systemd-s)
    Tasks: 2
   Memory: 324.0K
      CPU: 520ms
   CGroup: /system.slice/mysql.service
           └─control
             ├─26607 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─26676 sleep 1

Aug 23 19:17:34 ubuntu-1gb-nyc3-01 systemd[1]: Starting MySQL Community Server…
Aug 23 19:17:35 ubuntu-1gb-nyc3-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

journalctl -xe

-- Unit mysql.service has begun starting up.
Aug 23 19:19:05 ubuntu-1gb-nyc3-01 audit[26888]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/26888/status" pid=2688
Aug 23 19:19:05 ubuntu-1gb-nyc3-01 audit[26888]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" p
Aug 23 19:19:05 ubuntu-1gb-nyc3-01 audit[26888]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/26888/status" pid=2688
Aug 23 19:19:05 ubuntu-1gb-nyc3-01 kernel: audit: type=1400 audit(1503515945.954:748): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld"
Aug 23 19:19:05 ubuntu-1gb-nyc3-01 kernel: audit: type=1400 audit(1503515945.954:749): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld"
Aug 23 19:19:05 ubuntu-1gb-nyc3-01 kernel: audit: type=1400 audit(1503515945.954:750): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld"
Aug 23 19:19:06 ubuntu-1gb-nyc3-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 19:19:23 ubuntu-1gb-nyc3-01 sshd[26930]: Connection closed by 116.31.116.40 port 40327 [preauth]
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 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.
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 systemd[1]: mysql.service: Unit entered failed state.
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 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.
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 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.
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 audit[26981]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/26981/status" pid=2698
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 audit[26981]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" p
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 audit[26981]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/26981/status" pid=2698
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 kernel: audit: type=1400 audit(1503515976.446:751): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld"
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 kernel: audit: type=1400 audit(1503515976.446:752): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld"
Aug 23 19:19:36 ubuntu-1gb-nyc3-01 kernel: audit: type=1400 audit(1503515976.446:753): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld"
Aug 23 19:19:37 ubuntu-1gb-nyc3-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 19:19:48 ubuntu-1gb-nyc3-01 sudo[27025]:     root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/bin/journalctl -xe
Aug 23 19:19:48 ubuntu-1gb-nyc3-01 sudo[27025]: pam_unix(sudo:session): session opened for user root by root(uid=0)

tail -30 /var/log/mysql/error.log


2017-08-23T19:22:08.951104Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-08-23T19:22:08.951207Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-08-23T19:22:09.177161Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-23T19:22:09.181318Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.19-0ubuntu0.16.04.1) starting as process 27514 …
2017-08-23T19:22:09.190896Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-08-23T19:22:09.190945Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-08-23T19:22:09.190960Z 0 [Note] InnoDB: Uses event mutexes
2017-08-23T19:22:09.190971Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-08-23T19:22:09.190980Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-08-23T19:22:09.190990Z 0 [Note] InnoDB: Using Linux native AIO
2017-08-23T19:22:09.191768Z 0 [Note] InnoDB: Number of pools: 1
2017-08-23T19:22:09.192044Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-08-23T19:22:09.195523Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-08-23T19:22:09.213977Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-08-23T19:22:09.219177Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-08-23T19:22:09.233451Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-08-23T19:22:09.252993Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-08-23T19:22:09.253125Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait …
2017-08-23T19:22:09.264465Z 0 [Warning] InnoDB: 1048576 bytes should have been written. Only 851968 bytes written. Retrying for the remaining bytes.
2017-08-23T19:22:09.264519Z 0 [Warning] InnoDB: Retry attempts for writing partial data failed.
2017-08-23T19:22:09.264539Z 0 [ERROR] InnoDB: Write to file ./ibtmp1failed at offset 5242880, 1048576 bytes should have been written, only 851968 were written. Operating system error number 28. Check that your OS and file s2017-08-23T19:22:09.866980Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2017-08-23T19:22:09.867026Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-08-23T19:22:09.867033Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-08-23T19:22:09.867040Z 0 [ERROR] Failed to initialize plugins.
2017-08-23T19:22:09.867043Z 0 [ERROR] Aborting

2017-08-23T19:22:09.867049Z 0 [Note] Binlog end
2017-08-23T19:22:09.867098Z 0 [Note] Shutting down plugin 'MyISAM'
2017-08-23T19:22:09.867485Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

and i’m using ubuntu 16.04(1gb) Droplet

Thanks in advance

19 comments
  • Error was here (in bold) in the sysout:
    2017-08-23T19:22:09.253125Z 0 [Note] InnoDB: Setting file ’./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait …
    2017-08-23T19:22:09.264465Z 0 [Warning] InnoDB: 1048576 bytes should have been written. Only 851968 bytes written. Retrying for the remaining bytes.
    2017-08-23T19:22:09.264519Z 0 [Warning] InnoDB: Retry attempts for writing partial data failed.
    2017-08-23T19:22:09.264539Z 0 [ERROR] InnoDB: Write to file ./ibtmp1failed at offset 5242880, 1048576 bytes should have been written, only 851968 were written. Operating system error number 28. Check that your OS and file s2017-08-23T19:22:09.866980Z 0 [Note] InnoDB: Removed temporary tablespace data file: “ibtmp1”

    How much free space do you have on your droplet?

  • @iteagle03

    Here it is:

    Filesystem      Size  Used Avail Use% Mounted on
    udev            992M     0  992M   0% /dev
    tmpfs           201M   11M  190M   6% /run
    /dev/vda1        30G   29G  4.8M 100% /
    tmpfs          1001M     0 1001M   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs          1001M     0 1001M   0% /sys/fs/cgroup
    tmpfs           201M     0  201M   0% /run/user/0
    
    
  • Filesystem      Size  Used Avail Use% Mounted on
    udev            992M     0  992M   0% /dev
    tmpfs           201M   11M  190M   6% /run
    **/dev/vda1        30G   29G  4.8M 100% /**
    tmpfs          1001M     0 1001M   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs          1001M     0 1001M   0% /sys/fs/cgroup
    tmpfs           201M     0  201M   0% /run/user/0
    

    You appear to be out of space. From ’/’ if you run this command it will tell you your top 10 directories in terms of disk space used.

    du -aBM 2>/dev/null | sort -nr | head -n 10
    

    You can change the ‘10’ into any value you want … 20, 30, etc.

    There is another more “pretty” tool I found but you may not have enough space to install the utility.

  • @iteagle03

    ok i typed:

    du -aBM 2>/dev/null | sort -nr | head -n 10
    

    and it shows:

    root@ubuntu-1gb-nyc3-01:~# du -aBM 2>/dev/null | sort -nr | head -n 30
    5M      .
    4M      ./images
    3M      ./images/itv
    2M      ./images/itv.zip
    1M      ./.xsession-errors
    1M      ./.Xauthority
    1M      ./.vnc/xstartup
    1M      ./.vnc/ubuntu-1gb-nyc3-01:1.log
    1M      ./.vnc/passwd
    1M      ./.vnc
    1M      ./.viminfo
    1M      ./Videos
    1M      ./Templates
    1M      ./.ssh
    1M      ./Public
    1M      ./.profile
    1M      ./player/yendifplayer.js
    1M      ./player/yendifplayer.css
    1M      ./player/subtitles.vtt
    1M      ./player/player.swf
    1M      ./player/LICENSE.md
    1M      ./player/index.html
    1M      ./player/images/play.png
    1M      ./player/images/icons_white.png
    1M      ./player/images/icons_black.png
    1M      ./player/images
    1M      ./player/embed.js
    1M      ./player
    1M      ./Pictures
    1M      ./.nano/search_history
    

    Then what i need to do???

  • And you ran this command from the root of the directory ( ’/’ )? If you run ‘pwd’ and get something other than ’/’ you are not at the root directory. Once you are at root ('cd /’) and run that du command, you should get something like this:

    1936M   .
    1209M   ./usr
    361M    ./usr/src
    327M    ./usr/lib
    264M    ./usr/share
    246M    ./var
    222M    ./usr/bin
    212M    ./lib
    173M    ./var/lib
    159M    ./lib/modules
    

    Most of my disk usage is in the ’/usr’ directory, which is fine. I’m only using about 2GB out of 30GB for my droplet. :)

  • Show 14 more comments
3 Answers

You should first setup a swapfile. and also add line like this
innodb_buffer_pool_size = 20M to the end of the line of your /etc/mysql/my.cnf

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
innodb_buffer_pool_size = 20M```

Could you let us know what you’ve already tried to do to resolve your issue?
Have you googled your error? If so have you tried those solutions?
Have you tried purging mysql-server and start again?

@Aprexer

I tried start and stop mysql.service and install mysql tuner… and try to open my.cnf .... that’s it

Have another answer? Share your knowledge.