systemd is a new system and service manager for Linux system, which was implemented/adapted into all the major Linux distributions over the traditional SysV init systems due to lots of issue/improvement has to be on SysVinit systems.
All the service files are available on /etc/init.d/
directory for SysVinit system.
For systemd system, the service files are available on /usr/lib/systemd/system/
directory.
If you would like to perform any kind of actions like start, stop, restart, enable, reload & status against the specific service then use the following commands.
Make sure that you should have admin privileges to run these commands except status command. It should be root
or sudo
permission needed to run the below commands.
1) How To Start The MySQL/MariaDB Service In Linux?
Use the below commands to start the MySQL/MariaDB server in Linux.
For SysVinit
Systems – MySQL
Service.
# service mysql start or # /etc/init.d/mysql start
For SysVinit
Systems – MariaDB
Service
# service mariadb start or # /etc/init.d/mariadb start
For systemd
Systems – MySQL
Service.
# systemctl start mysql.service or # systemctl start mysql
For systemd
Systems – MariaDB
Service.
# systemctl start mariadb or # systemctl start mariadb.service
2) How To Stop The MySQL/MariaDB Service In Linux?
Use the below commands to stop the MySQL/MariaDB server in Linux.
For SysVinit
Systems – MySQL
Service.
# service mysql stop or # /etc/init.d/mysql stop
For SysVinit
Systems – MariaDB
Service
# service mariadb stop or # /etc/init.d/mariadb stop
For systemd
Systems – MySQL
Service.
# systemctl stop mysql.service or # systemctl stop mysql
For systemd
Systems – MariaDB
Service.
# systemctl stop mariadb or # systemctl stop mariadb.service
3) How To Restart The MySQL/MariaDB Service In Linux?
Use the below commands to restart the MySQL/MariaDB server in Linux.
For SysVinit
Systems – MySQL
Service.
# service mysql restart or # /etc/init.d/mysql restart
For SysVinit
Systems – MariaDB
Service
# service mariadb restart or # /etc/init.d/mariadb restart
For systemd
Systems – MySQL
Service.
# systemctl restart mysql.service or # systemctl restart mysql
For systemd
Systems – MariaDB
Service.
# systemctl restart mariadb or # systemctl restart mariadb.service
4) How To Reload The MySQL/MariaDB Service In Linux?
Use the below commands to reload the MySQL/MariaDB server in Linux.
For SysVinit
Systems – MySQL
Service.
# service mysql reload or # /etc/init.d/mysql reload
For SysVinit
Systems – MariaDB
Service
# service mariadb reload or # /etc/init.d/mariadb reload
For systemd
Systems – MySQL
Service.
# systemctl reload mysql.service or # systemctl reload mysql
For systemd
Systems – MariaDB
Service.
# systemctl reload mariadb or # systemctl reload mariadb.service
5) How To View The MySQL/MariaDB Service Status In Linux?
Use the below commands to view the MySQL/MariaDB server status in Linux.
For SysVinit
Systems – MySQL
Service.
# service mysql status or # /etc/init.d/mysql status
For SysVinit
Systems – MariaDB
Service
# service mariadb status or # /etc/init.d/mariadb status
For systemd
Systems – MySQL
Service.
# systemctl status mysql.service or # systemctl status mysql
For systemd
Systems – MariaDB
Service.
# systemctl status mariadb or # systemctl status mariadb.service
6) How To Enable The MySQL/MariaDB Service On Boot In Linux?
Use the below commands to enable the MySQL/MariaDB server on boot in Linux.
For SysVinit
Systems – MySQL
Service.
# chkconfig mysqld on
For SysVinit
Systems – MariaDB
Service
# chkconfig mariadb on
For systemd
Systems – MySQL
Service.
# systemctl enable mysql.service or # systemctl enable mysql
For systemd
Systems – MariaDB
Service.
# systemctl enable mariadb or # systemctl enable mariadb.service
For All service commands View More