Tuesday, November 11, 2014

systemctl and MySQL

So some users complete a yum install of MySQL and expect to be able to use the following  command to start the MySQL server::  /etc/init.d/mysql start only to get "No such file or directory"

So this is a quick post to help use the systemctl command. 
You are likely to see this:
# systemctl list-unit-files | grep mysql
mysqld.service                              disabled

First I would recommend go to tools.percona.com and create a valid my.cnf file. 

So the solution is easy, we just need to enable this so the database can start on server start up.

#systemctl enable mysqld.service
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/mysql.service'
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'
#systemctl start mysqld
#systemctl list-unit-files | grep mysql
mysql.service                               enabled
mysqld.service                              enabled 

Now you should be good to go...

No comments:

Post a Comment

@AnotherMySQLDBA