Maria DB (mysql) installation on Red Hat . How do I start service after installation

1.8k views Asked by At

I have installed mysql (maria db) on redhat.

My question is - how do I start and stop the server?

STEPS

I ran the command

$sudo yum install mysql

It gave long messages in the console while installing and and at the end said

Installed:
  mariadb.x86_64 1:5.5.41-2.el7_0

Dependency Installed:
  perl.x86_64 4:5.16.3-285.el7               perl-Carp.noarch 0:1.26-244.el7                 perl-Encode.x86_64 0:2.51-7.el7                     perl-Exporter.noarch 0:5.68-3.el7
  perl-File-Path.noarch 0:2.09-2.el7         perl-File-Temp.noarch 0:0.23.01-3.el7           perl-Filter.x86_64 0:1.49-3.el7                     perl-Getopt-Long.noarch 0:2.40-2.el7
  perl-HTTP-Tiny.noarch 0:0.033-3.el7        perl-PathTools.x86_64 0:3.40-5.el7              perl-Pod-Escapes.noarch 1:1.04-285.el7              perl-Pod-Perldoc.noarch 0:3.20-4.el7
  perl-Pod-Simple.noarch 1:3.28-4.el7        perl-Pod-Usage.noarch 0:1.63-3.el7              perl-Scalar-List-Utils.x86_64 0:1.27-248.el7        perl-Socket.x86_64 0:2.010-3.el7
  perl-Storable.x86_64 0:2.45-3.el7          perl-Text-ParseWords.noarch 0:3.29-4.el7        perl-Time-HiRes.x86_64 4:1.9725-3.el7               perl-Time-Local.noarch 0:1.2300-2.el7
  perl-constant.noarch 0:1.27-2.el7          perl-libs.x86_64 4:5.16.3-285.el7               perl-macros.x86_64 4:5.16.3-285.el7                 perl-parent.noarch 1:0.225-244.el7
  perl-podlators.noarch 0:2.5.1-3.el7        perl-threads.x86_64 0:1.87-4.el7                perl-threads-shared.x86_64 0:1.43-6.el7

But now when I run the command

$ sudo service mysql start

it gives messages

Redirecting to /bin/systemctl start mysql.service Failed to issue method call: Unit mysql.service failed to load: No such file or directory.

I am using Red hat version - Red Hat Enterprise Linux Server release 7.1 (Maipo)

2

There are 2 answers

1
DejanLekic On BEST ANSWER

I believe you've installed only the client. For the server do yum install mariadb-server. The package will install appropriate service file for you.

The name of the service though is mariadb. Well that is the case on CentOS 7 at least... So, after you install mariadb-server package do systemctl enable mariadb and systemctl start mariadb.

1
Mureinik On

The service is called mysqld, not mysql. So:

$ service mysqld start

Or better yet, use the proper systemd syntax:

$ systemctl start mysqld