2

I just started with centos 7. I'm trying to get replication working and am attempting to start mysql without starting the slave (so that I can set the pointers as to where it's supposed to resume replication before it starts). Typically I would do:

/etc/init.d/mysqld start --skip-slave-start

With centos 7, I need to use systemctl to start mysql, so I thought the equivalent command would be:

systemctl start mysqld.service --skip-slave-start

but the option "--skip-slave-start" doesn't seem to be working with systemctl. It shows the error: "systemctl: unrecognized option '--skip-slave-start'". Is there any way to get this option to work with systemctl? Is there any other easy way to start mysql without starting the slave along with it?

Thanks!!

2

systemctl is not your dæmon. It is not even a process that spawns your dæmon. It is a program that tells the service manager process to spawn your dæmon via Desktop Bus RPC.

So systemctl does not know anything about the command line arguments passed to your dæmon.

Those are in your dæmon's service unit file, the mysqld.service that you mention whose location is given by

systemctl status mysqld.service

You need to change the service's ExecStart setting, in particular. Here are the different ways to do this:

  1. Copy the package's mysqld.service to your own local /etc/systemd/system/mysqld.service service unit file. This has the disadvantage of not tracking updates from the package.
  2. Make an /etc/systemd/system/mysqld.service.d/skip-slave.conf override file that overrides just ExecStart. The systemd.unit manual page explains these.
  3. Edit the package-supplied mysqld.service service unit file. This is simply not the systemd way. Administrators aren't supposed to hand-edit stuff that is supplied by packages.
  4. Follow the detailed instructions given on lines 1 to 18 of the CentOS-supplied mysqld.service file, that explain how to employ .include in these circumstances.

Of course, don't forget

systemctl daemon-reload

  • Thank you for the detailed answer, and I'm sorry for my limited knowledge of Linux! I think it might just be easier for me to just change the my.cnf file to temporarily disable the slave before starting mysql normally. For anyone trying to do this you might want to consider looking at the answer to this question first: stackoverflow.com/questions/24011233/… Basically, add: "[mysqld] skip-slave-start" to the my.cnf file, start mysql, make the necessary changes, then stop mysql, chance the my.cnf file back and start mysql again. Thanks again! – WXMan Mar 29 '15 at 21:38

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.