Question
Job for mysqld.service failed See “systemctl status mysqld.service , journalctl -xe & tail -30 /var/log/mysql/error.log "
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
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
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:
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.
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:
and it shows:
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:
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. :)
@iteagle03
It’s showing that:
Ouch. You have so little space you have literally no wiggle room to work with.
Well, let’s wander into the /var/log directory and run the command ‘ls -halt’ and see if we have any large log files we could possibly clear out.
What are you using this droplet for that has used up so much disk space?
@iteagle03
it’s showing that:
I installed a wordpress site there and it’s using for technology blog
I’d delete any log file that is a .gz or .1 file that is larger than 5 MB.
auth.log.1 & btmp.1 are both pretty big.
I think you need to determine whether you need to keep around any log files older than two months as well (that is a .gz file).
Then go into either apache2 or nginx (whichever is your webserver) and lets see how big those log files are and see what we can do about them.
am i need to delete auth.log.1 & btmp.1 or not???
apache2:
It’s ultimately up to you what you delete but do you see what I am trying to do? I’m trying to go through your logs and clear up some space. Hopefully after clear out some big log files we’ll have enough disk space to run the ‘sudo du -aBM 2>/dev/null | sort -nr | head -n 10’ command (lets add sudo to include some directories that might only be accessible as a sudo or root user). From there you can really dive into where your disk usage is and attempt to resolve that roadblock.
Another command you can run after clearing out your log files might be 'sudo apt-get autoremove’ which will remove any packages that aren’t needed by your system.
It’s that or we add some block storage. You will know your sever better than anyone but something has eaten up all your available disk space.
@iteagle03
ok then we remove that btmp.1 file… i think it’s a size(89mb) to run ‘sudo du -aBM 2>/dev/null | sort -nr | head -n 10’…
is it ok??? basically i don’t have that much skill on that.......& that’s why i asked repeatedly…sorry
@iteagle03
i just delete btmp.1 file and and i use this command “sudo du -aBM 2>/dev/null | sort -nr | head -n 10” & i see there is a file in this directory “/var/www/html/wp-content/log/oooo here is file named dbcache(24gb) ” and deleted that file now disk space is:
but till mysql won’t start.... what i need to do now???
@iteagle03
now my apache2 and mysql both service is not starting it shows
apache2.service:
and mysql.service:
So, in regards to your apache2 error it can’t write to the directory ’/var/log/apache2/’. I have no idea what the problem is with mysql.
@iteagle03
write to the directory ’/var/log/apache2/’..... what i need to do???
Thanks
Is the directory present? If so, is the access.log, error.log, and othervhostsaccess.log log files present in the directory?
@iteagle03
I solved all issue…Thanks a lot
last.... can you help how to use any tool that can help to optimize or delete unnecessary file in ubuntu or any command???
Thanks not letting rest of the people know how did you solve the issue?