Question:

There is a critical issue going on with the Nautilus application in Stratos DC. The production support team identified that the application is unable to connect to the database. After digging into the issue, the team found that mariadb service is down on the database server.


Solution:

# SSH to the database server
ssh peter@stdb01

# Check the status of the mariadb service
sudo systemctl status mariadb
mariadb.service - MariaDB 10.5 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; preset: disabled)
     Active: inactive (dead)
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/

# Service is stopped. Lets try to restart the DB service
sudo systemctl restart mariadb
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xeu mariadb.service" for details.

Error:

Job for mariadb.service failed because the control process exited with error code.
See “systemctl status mariadb.service” and “journalctl -xeu mariadb.service” for details.

Lets investigate this error

sudo journalctl -xeu mariadb.service
Nov 08 17:42:03 stdb01 systemd[1]: Starting MariaDB 10.5 database server...
░░ Subject: A start job for unit mariadb.service has begun execution
░░ Defined-By: systemd
░░ Support: https://access.redhat.com/support
░░ 
░░ A start job for unit mariadb.service has begun execution.
░░ 
░░ The job identifier is 70738.
Nov 08 17:42:03 stdb01 mariadb-prepare-db-dir[26583]: chown: changing ownership of '/var/lib/mysql': Operation not permitted
Nov 08 17:42:03 stdb01 mariadb-prepare-db-dir[26584]: chmod: changing permissions of '/var/lib/mysql': Operation not permitted
Nov 08 17:42:03 stdb01 mariadb-prepare-db-dir[26525]: Initializing MariaDB database
Nov 08 17:42:04 stdb01 mariadb-prepare-db-dir[26613]: chown: changing ownership of '/var/lib/mysql': Operation not permitted
Nov 08 17:42:04 stdb01 mariadb-prepare-db-dir[26588]: Cannot change ownership of the database directories to the 'mysql'
Nov 08 17:42:04 stdb01 mariadb-prepare-db-dir[26588]: user.  Check that you have the necessary permissions and try again.
Nov 08 17:42:04 stdb01 mariadb-prepare-db-dir[26525]: Initialization of MariaDB database failed.
Nov 08 17:42:04 stdb01 mariadb-prepare-db-dir[26525]: Perhaps /etc/my.cnf is misconfigured or there is some problem with permissions of /var/lib/mysql.
Nov 08 17:42:04 stdb01 mariadb-prepare-db-dir[26525]: Initialization of MariaDB database was not finished successfully.
Nov 08 17:42:04 stdb01 mariadb-prepare-db-dir[26525]: Files created so far will be removed.
Nov 08 17:42:04 stdb01 systemd[1]: mariadb.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://access.redhat.com/support
░░ 
░░ An ExecStartPre= process belonging to unit mariadb.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Nov 08 17:42:04 stdb01 systemd[1]: mariadb.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://access.redhat.com/support
░░ 
░░ The unit mariadb.service has entered the 'failed' state with result 'exit-code'.
Nov 08 17:42:04 stdb01 systemd[1]: Failed to start MariaDB 10.5 database server.
░░ Subject: A start job for unit mariadb.service has failed
░░ Defined-By: systemd
░░ Support: https://access.redhat.com/support
░░ 
░░ A start job for unit mariadb.service has finished with a failure.
░░ 
░░ The job identifier is 70738 and the job result is failed.

Looking at the logs we see a permission error when changing the ownership of /var/lib/mysql. Set the correct permissions for /var/lib/mysql

sudo chown -R mysql:mysql /var/lib/mysql

# Now restart the DB service
sudo systemctl restart mariadb

# Check service status
sudo systemctl status mariadb
● mariadb.service - MariaDB 10.5 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; preset: disabled)
     Active: active (running) since Sun 2026-11-08 17:47:54 UTC; 7s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 28422 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS)
    Process: 28444 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
    Process: 28605 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS)
   Main PID: 28571 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 27 (limit: 404712)

By shafdo

Leave a Reply

Your email address will not be published. Required fields are marked *