首页 > Linux Usage > CentOS7.0使用系统服务如mariadb.service

CentOS7.0使用系统服务如mariadb.service

2015-03-17 14:13 星期二    浏览: 790    绿 发表评论 阅读评论

由于CentOS7.0不再默认使用MySQL数据库,取而代之的使用MySQL的开源社区版本MariaDB

因此,在yum install  mysql-server时会提示no mysql-server package available.

使用开源社区版本mariadb:

yum install mariadb mariadb-server

 

因CentOS7.0使用了systemd,不再使用原来的init.d,取而代之的使用systemctl命令启动/停止/查看 原来的服务。这在/etc/init.d/README文件有很好的说明:

You are looking for the traditional init scripts in /etc/rc.d/init.d,
and they are gone?

Here’s an explanation on what’s going on:

You are running a systemd-based OS where traditional init scripts have
been replaced by native systemd services files. Service files provide
very similar functionality to init scripts. To make use of service
files simply invoke “systemctl”, which will output a list of all
currently running services (and other units). Use “systemctl
list-unit-files” to get a listing of all known unit files, including
stopped, disabled and masked ones. Use “systemctl start
foobar.service” and “systemctl stop foobar.service” to start or stop a
service, respectively. For further details, please refer to
systemctl(1).

Note that traditional init scripts continue to function on a systemd
system. An init script /etc/rc.d/init.d/foobar is implicitly mapped
into a service unit foobar.service during system initialization.

Thank you!

Further reading:
man:systemctl(1)
man:systemd(1)

http://0pointer.de/blog/projects/systemd-for-admins-3.html

http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities

尽管还保留着对过去的兼容,可以继续使用service命令使用服务,如查看vsftd的状态和开启vsftpd:

service vsftpd status  –> systemctl status vsftpd.service

service vsftpd start–> systemctl start vsftpd.service

而过去的mysqld服务名称变更为mariadb.service,相应的操作是:

systemctl status mariadb.service

systemctl start mariadb.service

systemctl stop mariadb.service

另:查看所有服务详情列表,直接执行systemctl,不带任何参数

查看所有服务及状态:systemctl list-unit-files

 

本文链接地址: http://blog.redwolf-soft.com/?p=2436

原创文章,版权©红狼博客所有, 转载随意,但请注明出处。

    分享到:

相关文章:

  1. 本文目前尚无任何评论.
订阅评论
  欢迎参与讨论,请在这里发表您的看法、交流您的观点。