Today when I tried to restart mysql, it showed
root#S128046:~# service mysql restart
Job for mysql.service failed because the control process exited with error
code. See "systemctl status mysql.service" and "journalctl -xe" for details.
If I try systemctl status mysql.service, it says:
root#S128046:~# systemctl status mysql.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 Thu 2018-04-05 09:45:48 CST; 11s ago
Main PID: 19848 (code=exited, status=1/FAILURE); : 19849 (mysql-systemd-s)
Tasks: 2
Memory: 336.0K
CPU: 754ms
CGroup: /system.slice/mysql.service
└─control
├─19849 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─19903 sleep 1
Apr 05 09:45:48 S128046.domain systemd[1]: Stopped MySQL Community Server.
Apr 05 09:45:48 S128046.domain systemd[1]: Starting MySQL Community Server...
Apr 05 09:45:51 S128046.domain systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
And journalctl -xe says:
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Apr 05 09:47:25 S128046.domain audit[20171]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20171/status" pid=20171 comm="mysqld" req
Apr 05 09:47:25 S128046.domain audit[20171]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=20171 comm="mysq
Apr 05 09:47:25 S128046.domain audit[20171]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20171/status" pid=20171 comm="mysqld" req
Apr 05 09:47:25 S128046.domain kernel: audit: type=1400 audit(1522892845.214:527): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20171/s
Apr 05 09:47:25 S128046.domain kernel: audit: type=1400 audit(1522892845.214:528): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/
Apr 05 09:47:25 S128046.domain kernel: audit: type=1400 audit(1522892845.214:529): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20171/s
Apr 05 09:47:27 S128046.domain systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 09:47:56 S128046.domain 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.
Apr 05 09:47:56 S128046.domain systemd[1]: mysql.service: Unit entered failed state.
Apr 05 09:47:56 S128046.domain systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 05 09:47:56 S128046.domain systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
-- Unit mysql.service has begun starting up.
Apr 05 09:47:56 S128046.domain kernel: audit: type=1400 audit(1522892876.943:530): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20273/s
Apr 05 09:47:56 S128046.domain kernel: audit: type=1400 audit(1522892876.943:531): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/
Apr 05 09:47:56 S128046.domain kernel: audit: type=1400 audit(1522892876.943:532): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20273/s
Apr 05 09:47:56 S128046.domain audit[20273]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20273/status" pid=20273 comm="mysqld" req
Apr 05 09:47:56 S128046.domain audit[20273]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=20273 comm="mysq
Apr 05 09:47:56 S128046.domain audit[20273]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20273/status" pid=20273 comm="mysqld" req
Apr 05 09:47:59 S128046.domain systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
I do not why but mysql worked well for the past months.
Any help would be appreciated, thank you in advance.
try using superuser in ubuntu
sudo service mysql restart
this may work.
Related
I'm trying to change the Mysql data directory on Ubuntu 18.04.
I've followed the exact instructions here: https://www.digitalocean.com/community/tutorials/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-18-04
But when I get to the step:
sudo systemctl restart apparmor
I get the following error:
Job for apparmor.service failed because the control process exited with error code.
See "systemctl status apparmor.service" and "journalctl -xe" for details.
The output for systemctl status apparmor.service is:
apparmor.service - AppArmor initialization
Loaded: loaded (/lib/systemd/system/apparmor.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-08-23 09:34:03 CEST; 41s ago
Docs: man:apparmor(7)
http://wiki.apparmor.net/
Process: 18786 ExecStart=/etc/init.d/apparmor start (code=exited, status=123)
Main PID: 18786 (code=exited, status=123)
Aug 23 09:34:03 toto-X777K apparmor[18786]: Skipping profile in /etc/apparmor.d/disable: usr.bin.firefox
Aug 23 09:34:03 toto-X777K apparmor[18786]: AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at
Aug 23 09:34:03 toto-X777K apparmor[18786]: Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Aug 23 09:34:03 toto-X777K apparmor[18786]: Skipping profile in /etc/apparmor.d/disable: usr.bin.firefox
Aug 23 09:34:03 toto-X777K apparmor[18786]: AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at
Aug 23 09:34:03 toto-X777K apparmor[18786]: Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Aug 23 09:34:03 toto-X777K apparmor[18786]: ...fail!
Aug 23 09:34:03 toto-X777K systemd[1]: apparmor.service: Main process exited, code=exited, status=123/n/a
Aug 23 09:34:03 toto-X777K systemd[1]: apparmor.service: Failed with result 'exit-code'.
Aug 23 09:34:03 toto-X777K systemd[1]: Failed to start AppArmor initialization.
And the output for journalctl -xe is:
Aug 23 09:34:03 toto-X777K audit[18902]: AVC apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/snap/core/7396/usr/li
Aug 23 09:34:03 toto-X777K audit[18902]: AVC apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/snap/core/7396/usr/li
Aug 23 09:34:03 toto-X777K audit[18903]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18904]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18905]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18907]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18906]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18908]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18909]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18912]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18913]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18911]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18910]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18914]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18915]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18919]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18920]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18916]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18917]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18921]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18923]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18922]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K audit[18918]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile=
Aug 23 09:34:03 toto-X777K apparmor[18786]: ...fail!
Aug 23 09:34:03 toto-X777K systemd[1]: apparmor.service: Main process exited, code=exited, status=123/n/a
Aug 23 09:34:03 toto-X777K systemd[1]: apparmor.service: Failed with result 'exit-code'.
Aug 23 09:34:03 toto-X777K systemd[1]: Failed to start AppArmor initialization.
-- Subject: Unit apparmor.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit apparmor.service has failed.
--
-- The result is RESULT.
Aug 23 09:34:03 toto-X777K sudo[18781]: pam_unix(sudo:session): session closed for user root
lines 1022-1056/1056 (END)
Do you have any suggestions to fix the problem please?
I have tried the following the code to restart the MySql services
sudo service mysql restart
got the following error
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
ubuntu#ip-172-31-52-10:~$ journalctl -xe
And the journalctl Log says
Unit mysql.service has begun starting up.
Mar 17 15:10:55 ip-172-31-52-10 audit[4057]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=4057 comm="mysqld" r
Mar 17 15:10:55 ip-172-31-52-10 kernel: audit: type=1400 audit(1552835455.957:54): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/syst
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: ERROR: Unable to start MySQL server:
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: 2019-03-17T15:10:56.000286Z 0 [ERROR] unknown variable 'bind=0.0.0.0'
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: 2019-03-17T15:10:56.004319Z 0 [ERROR] Aborting
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Mar 17 15:10:56 ip-172-31-52-10 mysql-systemd-start[4038]: Once the problem is resolved, restart the service.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Control process exited, code=exited status=1
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Failed with result 'exit-code'.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has finished shutting down.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Start request repeated too quickly.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: mysql.service: Failed with result 'exit-code'.
Mar 17 15:10:56 ip-172-31-52-10 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
how do I fix this?
I was having problems starting the MySQL service so I removed the packages like this:
sudo dpkg -P mysql-server mysql-server-5.7
sudo apt autoremove
sudo apt clean
sudo rm -rvf /var/lib/mysql
sudo apt install mysql-server
During installation, I was asked for the password for root and after that, the following happened:
Setting up mysql-server-5.7 (5.7.21-0ubuntu0.16.04.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mo 2018-04-23 17:22:42 CEST; 6ms ago
Process: 27860 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 27859 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 27851 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 27859 (code=exited, status=1/FAILURE)
Apr 23 17:22:42 mari systemd[1]: Failed to start MySQL Community Server.
Apr 23 17:22:42 mari systemd[1]: mysql.service: Unit entered failed state.
Apr 23 17:22:42 mari systemd[1]: mysql.service: Failed with result 'exit-code'.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.7
mysql-server
Running dpkg --configure -a results in the same errors. Here's journalctl -xe:
-- 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.
Apr 23 17:25:20 mari audit[28913]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/28913/status" pid=28913 comm="mysqld
Apr 23 17:25:20 mari audit[28913]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=28913 comm=
Apr 23 17:25:20 mari audit[28913]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/28913/status" pid=28913 comm="mysqld
Apr 23 17:25:20 mari kernel: audit: type=1400 audit(1524497120.211:209): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/28
Apr 23 17:25:22 mari systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Apr 23 17:25:50 mari 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.
Apr 23 17:25:50 mari systemd[1]: mysql.service: Unit entered failed state.
Apr 23 17:25:50 mari systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 23 17:25:50 mari sudo[28755]: pam_unix(sudo:session): session closed for user root
Apr 23 17:25:50 mari systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 23 17:25:50 mari 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.
Apr 23 17:25:50 mari 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.
Apr 23 17:25:50 mari audit[29041]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/29041/status" pid=29041 comm="mysqld
Apr 23 17:25:50 mari audit[29041]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=29041 comm=
Apr 23 17:25:50 mari audit[29041]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/29041/status" pid=29041 comm="mysqld
Apr 23 17:25:50 mari kernel: kauditd_printk_skb: 2 callbacks suppressed
Apr 23 17:25:50 mari kernel: audit: type=1400 audit(1524497150.668:212): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/29
Apr 23 17:25:50 mari kernel: audit: type=1400 audit(1524497150.668:213): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/dev
Apr 23 17:25:50 mari kernel: audit: type=1400 audit(1524497150.668:214): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/29
Apr 23 17:25:52 mari systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Others seem to have the same problem but none of the solutions I found so far worked. For example, someone said that their problem was being caused by a missing log file which is not missing for me.
Thank you to Michael O. for the comment, it helped me out tremendously. The answer to the question he linked by itself didn't solve my problem as, after whitelisting MySQL to access the files it needed, apparmor started to block MySQL from acquiring capabilities.
While searching I came across this blog post from Oracle that suggests using apparmor-utils's utility called aa-complain. This utility sets a profile to complain mode, basically letting you off with a warning.
So I installed apparmor-utils:
sudo apt install apparmor-utils
Checked where the MySQL service was located:
which mysql
And used the output to put the service on complain mode:
aa-complain /usr/bin/mysql
After restarting the computer the service started without errors.
My laptop suddenly crashed with a BSD and after a restart and logging back in, mysql is causing me problems.
I am using vagrant with mysql inside on UBUNTU.
root#dev:/var/lib/mysql# service mysql start
Job for mysql.service failed because the control process exited with
error code. See "systemctl status mysql.service" and "journalctl -xe"
for details.
Running systemctl status mysql.service shows the following
* mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-01-04 11:08:55 GMT;
14s ago
Docs: man:systemd-sysv-generator(8)
Process: 19954 ExecStart=/etc/init.d/mysql start (code=exited,
status=1/FAILURE)
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: 0 processes alive and
'/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping'
resulted in
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: [61B blob data]
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: error: 'Can't connect to
local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: Check that mysqld is
running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]:
Jan 04 11:08:55 dev mysql[19954]: ...fail!
Jan 04 11:08:55 dev systemd[1]: mysql.service: Control process exited,
code=exited status=1
Jan 04 11:08:55 dev systemd[1]: Failed to start LSB: Start and stop the
mysql database server daemon.
Jan 04 11:08:55 dev systemd[1]: mysql.service: Unit entered failed
state.
Jan 04 11:08:55 dev systemd[1]: mysql.service: Failed with result
'exit-code'.
Running journalctl -xe shows the following
Jan 04 11:08:53 dev kernel: audit: type=1400 audit(1515064133.370:391): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20386 comm="mysqld" requested_ma
Jan 04 11:08:54 dev audit[20397]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20397 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jan 04 11:08:54 dev audit[20397]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20397 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 oui
Jan 04 11:08:54 dev kernel: audit: type=1400 audit(1515064134.382:392): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20397 comm="mysqld" requested_mask="r" denied_m
Jan 04 11:08:54 dev kernel: audit: type=1400 audit(1515064134.382:393): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20397 comm="mysqld" requested_ma
Jan 04 11:08:55 dev audit[20408]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20408 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jan 04 11:08:55 dev audit[20408]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20408 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 oui
Jan 04 11:08:55 dev kernel: audit: type=1400 audit(1515064135.398:394): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20408 comm="mysqld" requested_mask="r" denied_m
Jan 04 11:08:55 dev kernel: audit: type=1400 audit(1515064135.398:395): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20408 comm="mysqld" requested_ma
Jan 04 11:08:55 dev audit[20418]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20418 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jan 04 11:08:55 dev audit[20418]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20418 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 oui
Jan 04 11:08:55 dev kernel: audit: type=1400 audit(1515064135.410:396): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20418 comm="mysqld" requested_mask="r" denied_m
Jan 04 11:08:55 dev kernel: audit: type=1400 audit(1515064135.410:397): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20418 comm="mysqld" requested_ma
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: [61B blob data]
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]:
Jan 04 11:08:55 dev mysql[19954]: ...fail!
Jan 04 11:08:55 dev systemd[1]: mysql.service: Control process exited, code=exited status=1
Jan 04 11:08:55 dev systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
-- 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.
Jan 04 11:08:55 dev systemd[1]: mysql.service: Unit entered failed state.
Jan 04 11:08:55 dev systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 04 11:09:01 dev CRON[20427]: pam_unix(cron:session): session opened for user root by (uid=0)
Jan 04 11:09:01 dev CRON[20428]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jan 04 11:09:01 dev CRON[20427]: pam_unix(cron:session): session closed for user root
Jan 04 11:09:02 dev systemd[1]: Starting Clean php session files...
-- Subject: Unit phpsessionclean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit phpsessionclean.service has begun starting up.
Jan 04 11:09:02 dev sessionclean[20429]: Cannot load Xdebug - it was already loaded
Jan 04 11:09:02 dev sessionclean[20429]: Cannot load Xdebug - it was already loaded
Jan 04 11:09:02 dev sessionclean[20429]: Cannot load Xdebug - it was already loaded
Jan 04 11:09:02 dev systemd[1]: Started Clean php session files.
-- Subject: Unit phpsessionclean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit phpsessionclean.service has finished starting up.
--
-- The start-up result is done.
I cannot see any mysqld.sock file and i have tried to start in safe mode with recovery options etc but i have no success. Any help would be very much appreciated.
After editing /etc/mysql/mysql.conf.d/mysqld.cnf to change my bind address to allow external connections to my MySQL database, I tried restarting the MySQL service to get the following error:
ubuntu#resonance:/var/www/html$ sudo service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
upon typing both of those commands, I get the following:
Nov 15 17:45:06 resonance 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.
Nov 15 17:45:06 resonance 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.
Nov 15 17:45:06 resonance audit[24219]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/24219/status" pid=24219 com
Nov 15 17:45:06 resonance audit[24219]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=24
Nov 15 17:45:06 resonance audit[24219]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/24219/status" pid=24219 com
Nov 15 17:45:06 resonance kernel: audit: type=1400 audit(1510767906.536:98): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="
Nov 15 17:45:06 resonance kernel: audit: type=1400 audit(1510767906.536:99): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="
Nov 15 17:45:06 resonance kernel: audit: type=1400 audit(1510767906.536:100): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name=
Nov 15 17:45:08 resonance systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Nov 15 17:45:26 resonance dhclient[1326]: DHCPREQUEST of 10.2.6.251 on ens3 to 10.2.11.18 port 67 (xid=0x7d5eaaff)
Nov 15 17:45:26 resonance dhclient[1326]: DHCPACK of 10.2.6.251 from 10.2.11.18
Nov 15 17:45:26 resonance root[24322]: /etc/dhcp/dhclient-enter-hooks.d/avahi-autoipd returned non-zero exit status 1
Nov 15 17:45:26 resonance dhclient[1326]: bound to 10.2.6.251 -- renewal in 53 seconds.
and
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) since Wed 2017-11-15 17:46:38 UTC; 84ms ago
Process: 24586 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 24595 (mysqld); : 24596 (mysql-systemd-s)
Tasks: 3
Memory: 1.4M
CPU: 86ms
CGroup: /system.slice/mysql.service
├─24595 /usr/sbin/mysqld
└─control
├─24596 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─24601 sleep 1
Nov 15 17:46:38 resonance systemd[1]: Starting MySQL Community Server...
any idea what I'm doing wrong? This is the file I changed:
https://pastebin.com/pevhYMNK
EDIT
So I tried changing the bind IP back to 127.0.0.1 and it started working again. What do I have to do to allow external connections? I really need it working.
You should comment out bind-address and skip-netwroking lines in your config and then restart.