The cart is empty

The error message "Failed to start MariaDB.service: Unit not found" encountered while attempting to start MariaDB on a CentOS 7 system suggests that the MariaDB service is not properly installed or configured. This article provides a step-by-step guide on how to address this issue.

Causes of the Problem

  1. Incomplete or Incorrect Installation: MariaDB was not fully or correctly installed.
  2. Incorrect System Configuration: The system link to the mariadb.service is missing or corrupted.
  3. Version Conflicts: Multiple versions of MySQL or MariaDB are installed on the system, causing conflicts.

Solution

Step 1: Verify MariaDB Installation

The first step is to verify that MariaDB is correctly installed on your system.

  1. Run the command yum list installed | grep mariadb to check if MariaDB is installed.
  2. If MariaDB is not installed, install it using the command sudo yum install mariadb-server.

Step 2: Start the MariaDB Service

After verifying or installing MariaDB, it is necessary to start the service and enable it for automatic startup.

  1. Run sudo systemctl start mariadb to attempt to start the service.
  2. Use sudo systemctl enable mariadb to set the MariaDB service to start automatically upon system boot.

Step 3: Check Service Status

Verify that the MariaDB service is running without issues.

  • Run sudo systemctl status mariadb to check the status of the service.

Step 4: Configure MariaDB

After successfully starting the service, it is recommended to perform basic configuration.

  • Run sudo mysql_secure_installation for security configuration, such as setting the root password and removing anonymous users.

Step 5: Resolve Version Conflict Issues

If you have multiple versions of MySQL or MariaDB installed on the system, conflicts may occur.

  1. Remove old or unnecessary versions using sudo yum remove mysql* mariadb*.
  2. Reinstall the desired version of MariaDB.

Conclusion

The error message "Failed to start mariadb.service: Unit not found" typically indicates issues with the installation or configuration of MariaDB on CentOS 7. Follow the above steps to resolve this problem. It is important to note that proper installation and configuration of database systems are crucial for ensuring their reliable and secure operation.