Page 1 of 1

Restarting MariaDB

Posted: Mon Sep 10, 2018 11:42 am
by daansk44
Hey,

How can I restart MariaDB on centOS7
With the absolute path? (I cannot find it)

Re: Restarting MariaDB

Posted: Mon Sep 10, 2018 4:13 pm
by xorro
Ignore / Do not copy the # sign when you copy the command.

Start MariaDB / MySQL

Code: Select all

# For Sysvinit Systems #
# service mysql start
or
# /etc/init.d/mysql start

# For Systemd Systems #
# systemctl start mariadb.service
or
# systemctl start mysql.service
or
# systemctl start mariadb
or
# systemctl start mysql
Stop MariaDB / MySQL

Code: Select all

# For Sysvinit Systems #
# service mysql stop
or
# /etc/init.d/mysql stop

# For Systemd Systems #
# systemctl stop mariadb.service
or
# systemctl stop mysql.service
or
# systemctl stop mariadb
or
# systemctl stop mysql
Restart MariaDB / MySQL

Code: Select all

# For Sysvinit Systems #
# service mysql restart
or
# /etc/init.d/mysql restart

# For Systemd Systems #
# systemctl restart mariadb.service
or
# systemctl restart mysql.service
or
# systemctl restart mariadb
or
# systemctl restart mysql
Reload MariaDB / MySQL

Code: Select all

# For Sysvinit Systems #
# service mysql reload
or
# /etc/init.d/mysql reload

# For Systemd Systems #
# systemctl reload mariadb.service
or
# systemctl reload mysql.service
or
# systemctl reload mariadb
or
# systemctl reload mysql
Check MariaDB / MySQL Status

Code: Select all

# For Sysvinit Systems #
# service mysql status
or
# /etc/init.d/mysql status

# For Systemd Systems #
# systemctl status mariadb.service
or
# systemctl status mysql.service
or
# systemctl status mariadb
or
# systemctl status mysql
Auto Boot MariaDB / MySQL on Boot

Code: Select all

# For Sysvinit Systems #
# chkconfig mysqld on

# For Systemd Systems #
# systemctl enable mariadb.service
or
# systemctl enable mysql.service
or
# systemctl enable mariadb
or
# systemctl enable mysql

Re: Restarting MariaDB

Posted: Mon Sep 10, 2018 6:06 pm
by daansk44
Thank you for your reply.

The problem is that the mysql server goes down sometimes.
And I want to fix that using monit.
For that I need to have the absolute path of mysql / mariaDB.
But when I use this /etc/init.d/mysqld it cannot be found

Code: Select all

check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout
The problem when I do this: /etc/init.d/mysql restart
I get this returned

Code: Select all

-bash: /etc/init.d/mysql: No such file or directory
When I try to run this command in monit, I will get this error

Code: Select all

systemctl start mariadb

Code: Select all

/etc/monitrc:284: Program does not exist: 'systemctl'