0

After I configured MySQL 5.7.20 to listen for remote connections on Ubuntu 17.10 Linux server, the database refused to restart.

I had edited the /etc/mysql/mysql.conf.d/mysqld.cnf and made the following two-line changes (the bind ip address was intentionally hidden):

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 127.0.0.1
bind-address            = ###.###.###.###
require_secure_transport = on

The following errors are from journalctl -xe:

-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has finished shutting down.
May 01 14:02:58 xweb02 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has begun starting up.
May 01 14:02:58 xweb02 audit[12934]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/12934/status" pid=12934 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:02:58 xweb02 audit[12934]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=12934 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=0
May 01 14:02:58 xweb02 audit[12934]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/12934/status" pid=12934 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:02:58 xweb02 kernel: audit: type=1400 audit(1525197778.760:435): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/12934/status" pid=12934 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:02:58 xweb02 kernel: audit: type=1400 audit(1525197778.761:436): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=12934 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=0
May 01 14:02:58 xweb02 kernel: audit: type=1400 audit(1525197778.761:437): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/12934/status" pid=12934 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:03:00 xweb02 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
May 01 14:03:28 xweb02 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 failed.
May 01 14:03:28 xweb02 systemd[1]: mysql.service: Unit entered failed state.
May 01 14:03:28 xweb02 systemd[1]: mysql.service: Failed with result 'exit-code'.
May 01 14:03:28 xweb02 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
May 01 14:03:28 xweb02 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.
May 01 14:03:28 xweb02 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has begun starting up.
May 01 14:03:29 xweb02 audit[13059]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/13059/status" pid=13059 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:03:29 xweb02 audit[13059]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=13059 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=0
May 01 14:03:29 xweb02 audit[13059]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/13059/status" pid=13059 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:03:29 xweb02 kernel: audit: type=1400 audit(1525197809.010:438): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/13059/status" pid=13059 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:03:29 xweb02 kernel: audit: type=1400 audit(1525197809.011:439): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=13059 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=0
May 01 14:03:29 xweb02 kernel: audit: type=1400 audit(1525197809.011:440): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/13059/status" pid=13059 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:03:30 xweb02 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
May 01 14:03:59 xweb02 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 failed.
May 01 14:03:59 xweb02 systemd[1]: mysql.service: Unit entered failed state.
May 01 14:03:59 xweb02 systemd[1]: mysql.service: Failed with result 'exit-code'.
May 01 14:03:59 xweb02 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
May 01 14:03:59 xweb02 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.
May 01 14:03:59 xweb02 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has begun starting up.
May 01 14:03:59 xweb02 audit[13182]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/13182/status" pid=13182 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:03:59 xweb02 audit[13182]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=13182 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=0
May 01 14:03:59 xweb02 audit[13182]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/13182/status" pid=13182 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:03:59 xweb02 kernel: audit: type=1400 audit(1525197839.260:441): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/13182/status" pid=13182 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:03:59 xweb02 kernel: audit: type=1400 audit(1525197839.260:442): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=13182 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=0
May 01 14:03:59 xweb02 kernel: audit: type=1400 audit(1525197839.260:443): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/13182/status" pid=13182 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=126 ouid=126
May 01 14:04:01 xweb02 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

If I comment my changes and uncomment the first address-bind, then it works:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address           = 127.0.0.1
#bind-address            = ###.###.###.###
#require_secure_transport = on

Finally, if I uncomment both the first bind-address and the require_secure_transport, and comment the second address-bind, then it works:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address           = 127.0.0.1
#bind-address            = ###.###.###.###
require_secure_transport = on

The problem appears to be with the bind-address line. Any help with this issue is appreciated.

0

The bind-address was set to the private IP address of the server that MySQL is on. It Worked!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.