we have MySQL Enterprise Server – Advanced Edition (Commercial) installed on Centos7

Lolu911 asked:

I always have to start it manually on boot everything the server is down and boots up. Someone help me set it to start on boot with systemctl enable

[root@localhost ~]# systemctl enable mysqld

Failed to issue method call: Access denied

[root@localhost ~]# systemctl status mysqld

   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

[root@localhost ~]# systemctl status mysql

mysql.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mysql)

   Active: active (running) since Mon 2015-10-26 10:18:16 EDT; 2 days ago
   CGroup: /system.slice/mysql.service
                ├─1485 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/trimdb03.pid
 └─2523 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --
plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-

error=/var/lib/mysql/mysql.err --pid-file=/...

Oct 26 10:18:06 localhost systemd[1]: Starting LSB: start and stop MySQL...

Oct 26 10:18:16 localhost mysql[1244]: Starting MySQL......... SUCCESS!

Oct 26 10:18:16 localhost systemd[1]: Started LSB: start and stop MySQL.

[root@localhost ~]# systemctl enable mysql

mysql.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysql on

The unit files have no [Install] section. They are not meant to be enabled
using systemctl.

Possible reasons for having this kind of units are:

1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.

2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.

3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

[root@localhost ~]#

My answer:

For some reason MySQL is using an old-style init script, even on CentOS 7, which uses systemd. They should have distributed a proper systemd unit file, but chose not to.

The proper way to enable an old-style init script is with chkconfig, i.e.:

chkconfig mysql on

If this still fails, then you need to get very loud and angry with your Oracle support contact.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.