简体   繁体   中英

Can't Start MySQL Service Ubuntu

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.

您应该在配置中注释掉bind-addressskip-netwroking行,然后重新启动。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM