mariadb 10.3 > service mysql status > failed

Issues related to applications and software problems
Post Reply
Marcuszan
Posts: 6
Joined: 2019/06/19 10:52:53

mariadb 10.3 > service mysql status > failed

Post by Marcuszan » 2019/06/19 11:11:11

Hi,
First of all. I am new here. This is my first post.

I am a novice sysadmin.
I have a CentOs 7.6 server. I upgraded from mysql 5.7 to mariadb 10.3

Now when giving this command

Code: Select all

service mysql status
I get :

Code: Select all

MariaDB is not running                                     [FAILED]
However, it seems mariadb is running. when doing this :

Code: Select all

systemctl status mariadb.service
it returns

Code: Select all

● mariadb.service - MariaDB 10.3.16 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf, protecthome.conf
   Active: active (running) since Wed 2019-06-19 07:05:33 EDT; 54s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 10252 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 10180 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 10151 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 10216 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─10216 /usr/sbin/mysqld

Jun 19 07:05:28 server-ip.net systemd[1]: Starting MariaDB 10.3.16 database server...
Jun 19 07:05:28 server-ip.net mysqld[10216]: 2019-06-19  7:05:28 0 [Note] /usr/sbin/mysqld (mysqld 10.3.16-MariaDB) starting as process 10216 ...
Jun 19 07:05:33 server-ip.net systemd[1]: Started MariaDB 10.3.16 database server.
Anyone knows why the first command tells me mariadb is not running ?

Thanks in advance

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: mariadb 10.3 > service mysql status > failed

Post by hunter86_bg » 2019/06/19 12:55:52

Because the service was started via systemd service instead of the systemV scripts.

You should avoid using the 'service' command on CentOS7.

Marcuszan
Posts: 6
Joined: 2019/06/19 10:52:53

Re: mariadb 10.3 > service mysql status > failed

Post by Marcuszan » 2019/06/19 14:20:22

thanks !

Marcuszan
Posts: 6
Joined: 2019/06/19 10:52:53

Re: mariadb 10.3 > service mysql status > failed

Post by Marcuszan » 2019/06/19 21:18:38

I dont understand this. When I do >

Code: Select all

service mariadb status
it says

Code: Select all

Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB 10.3.16 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf, protecthome.conf
   Active: active (running) since wo 2019-06-19 17:05:24 EDT; 6min ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 9108 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 6882 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 6730 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 7608 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─7608 /usr/sbin/mysqld

jun 19 17:05:07 server-ip.net systemd[1]: Starting MariaDB 10.3.16 database server...
jun 19 17:05:11 server-ip.net mysqld[7608]: 2019-06-19 17:05:11 0 [Note] /usr/sbin/mysqld (mysqld 10.3.16-MariaDB) starting as process 7608 ...
jun 19 17:05:24 server-ip.net systemd[1]: Started MariaDB 10.3.16 database server.

However, the following doesnt work, as described in initial post

Code: Select all

service mysql status
output >

Code: Select all

MariaDB is not running                                     [FAILED]
what would cause the last command not being redirected to systemctl, while the first command is redirected to systemctl ?

Thanks

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: mariadb 10.3 > service mysql status > failed

Post by pjsr2 » 2019/06/20 09:44:59

CentOS uses systemd to control the services, including the MariaDB server.
You should use the systemctl command to control and interrogate the services, like

Code: Select all

systemctl start mariadb
systemctl stop mariadb
systemctl restart mariadb
systemctl status mariadb
systemctl enable mariadb
systemctl disable mariadb
The "service" command is available for backward compatibility, but it does not always work as expected. Avoid it. Get in the habit to use systemctl.

According to the "status" output, the server mysqld is running with pid 7608.
You can independently check if this program is still running with

Code: Select all

ps -C mysqld

Marcuszan
Posts: 6
Joined: 2019/06/19 10:52:53

Re: mariadb 10.3 > service mysql status > failed

Post by Marcuszan » 2019/06/20 10:52:02

Thank you for this explanation

Marcuszan
Posts: 6
Joined: 2019/06/19 10:52:53

Re: mariadb 10.3 > service mysql status > failed

Post by Marcuszan » 2019/06/20 23:29:57

One more question.

On CentOS 7

As I understand the command

Code: Select all

service mysql status
Will ALWAYS return 'not running', even as it is.
Is this correct and are there docs that confirm this ?



Thanks again for your time.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: mariadb 10.3 > service mysql status > failed

Post by TrevorH » 2019/06/20 23:43:03

Even on CentOS 6 the command service mysql status will not work. The service was called mysqld not mysql.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Marcuszan
Posts: 6
Joined: 2019/06/19 10:52:53

Re: mariadb 10.3 > service mysql status > failed

Post by Marcuszan » 2019/06/21 00:05:35

Confirmed

Code: Select all

service mysqld status
works

Post Reply