4

In terminal I do: sudo service mysql start

and I get: Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

systemctl status mysql.service gives me:

● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-10-31 22:05:05 UTC; 4s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 3592 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE) Process: 3542 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 3592 (code=exited, status=1/FAILURE) Status: "SERVER_BOOTING" Error: 13 (Permission denied)

Oct 31 22:05:04 brawn systemd[1]: Starting MySQL Community Server... Oct 31 22:05:05 brawn mysqld[3592]: 2018-10-31T22:05:05.104214Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld Oct 31 22:05:05 brawn mysqld[3592]: mysqld: File './binlog.index' not found (OS errno 13 - Permission denied) Oct 31 22:05:05 brawn mysqld[3592]: 2018-10-31T22:05:05.106057Z 0 [ERROR] [MY-010119] [Server] Aborting Oct 31 22:05:05 brawn mysqld[3592]: 2018-10-31T22:05:05.106193Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld Oct 31 22:05:05 brawn systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE Oct 31 22:05:05 brawn systemd[1]: mysql.service: Failed with result 'exit-code'. Oct 31 22:05:05 brawn systemd[1]: Failed to start MySQL Community Server.

and journalctl -xe gives me:

-- Unit mysql.service has begun starting up.
Oct 31 22:05:04 brawn audit[3591]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profi
Oct 31 22:05:04 brawn kernel: audit: type=1400 audit(1541023504.856:30): apparmor="STATUS" operation="profile_re
Oct 31 22:05:05 brawn mysqld[3592]: 2018-10-31T22:05:05.104214Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld
Oct 31 22:05:05 brawn mysqld[3592]: mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
Oct 31 22:05:05 brawn mysqld[3592]: 2018-10-31T22:05:05.106057Z 0 [ERROR] [MY-010119] [Server] Aborting
Oct 31 22:05:05 brawn mysqld[3592]: 2018-10-31T22:05:05.106193Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld
Oct 31 22:05:05 brawn systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 31 22:05:05 brawn systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 31 22:05:05 brawn 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.
Oct 31 22:05:05 brawn sudo[3512]: pam_unix(sudo:session): session closed for user root

Im quite new to Ubuntu and MySql, but I believe this issue is that for some reason MySql can no longer access './binlog.index', am I on the right track and how do I fix this?

I did try sudo find / -name binlog.index which gave me one result:

/var/lib/mysql/binlog.index

But how do I for it? what permission is required?

1

3 Answers 3

3

I ran sudo chown -R mysql:mysql /var/lib/mysql to give the mysql user permission on this folder, but do let me know if I have done the wrong thing.

1
  • It doesn't help :(
    – nowox
    Dec 1, 2018 at 21:04
2

For me the issue was caused by the custom values that I had added to my.cnf:

#query_cache_size = 0
#query_cache_type = 0
#query_cache_limit = 2M
#sort_buffer_size = 512K
#read_rnd_buffer_size = 512K
#tmp_table_size = 32M
#max_heap_table_size = 32M
#thread_pool_size = 24M
#innodb_log_file_size = 16M

As soon as those were commended out I didn't have any more issues.

0

This is clear a apparmor issue meaning you have to edit the configuration of apparmor for the mysql server:

/etc/apparmor.d/usr.sbin.mysqld

It should be like this:

    #include <tunables/global>

/usr/sbin/mysqld {
  #include <abstractions/base>
  #include <abstractions/nameservice>
  #include <abstractions/user-tmp>
  #include <abstractions/mysql>
  #include <abstractions/winbind>

# Allow system resource access
  /sys/devices/system/cpu/ r,
  /sys/devices/system/node/ r,
  /sys/devices/system/node/** r,
  /proc/*/status r,
  capability sys_resource,
  capability dac_override,
  capability setuid,
  capability setgid,
  capability sys_nice,

# Allow network access
  network tcp,

  /etc/hosts.allow r,
  /etc/hosts.deny r,

# Allow config access
  /etc/mysql/** r,

# Allow pid, socket, socket lock file access
  /var/run/mysqld/mysqld.pid rw,
  /var/run/mysqld/mysqld.sock rw,
  /var/run/mysqld/mysqld.sock.lock rw,
  /var/run/mysqld/mysqlx.sock rw,
  /var/run/mysqld/mysqlx.sock.lock rw,
  /run/mysqld/mysqld.pid rw,
  /run/mysqld/mysqld.sock rw,
  /run/mysqld/mysqld.sock.lock rw,
  /run/mysqld/mysqlx.sock rw,
  /run/mysqld/mysqlx.sock.lock rw,

# Allow systemd notify messages
  /{,var/}run/systemd/notify w,

# Allow execution of server binary
  /usr/sbin/mysqld mr,
  /usr/sbin/mysqld-debug mr,

# Allow plugin access
  /usr/lib/mysql/plugin/ r,
  /usr/lib/mysql/plugin/*.so* mr,

# Allow error msg and charset access
  /usr/share/mysql/ r,
  /usr/share/mysql/** r,
  /usr/share/mysql-8.0/ r,
  /usr/share/mysql-8.0/** r,

# Allow data dir access
  /var/lib/mysql/ r,
  /var/lib/mysql/** rwk,

# Allow data files dir access
  /var/lib/mysql-files/ r,
  /var/lib/mysql-files/** rwk,

# Allow keyring dir access
  /var/lib/mysql-keyring/ r,
  /var/lib/mysql-keyring/** rwk,

# Allow log file access
  /var/log/mysql/ r,
  /var/log/mysql/** rw,

# Allow access to openssl config
  /etc/ssl/openssl.cnf r,

  # Site-specific additions and overrides. See local/README for details.
  include <local/usr.sbin.mysqld>
}
  • check that the paths are matching your mysql configurations and directories

and last systemctl restart apparmor; systemctl mysql start

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .