---
title: "Database issues"
description: ""
url: "https://docs.itrsgroup.com/docs/opsview/6.11.7/troubleshooting/database-issues/index.html"
---
## Opsview in error state after switching to a different database vendor

Changing the database vendor (such as from MariaDB to MySQL or vice versa) in an existing Opsview deployment is not supported. Any attempts will cause playbook execution for `check-deploy.yml` and `setup-everything.yml` to fail, and Opsview will enter an error state.

To restore Opsview and its databases to their previous state, do the following:

1. In the `user_vars.yml` file, remove the specified `opsview_database_package_vendor` and `opsview_database_package_version` fields.
2. Rerun the deployment playbooks.

  ```
  cd /opt/opsview/deploy
  ./bin/opsview-deploy lib/playbooks/check-deploy.yml
  ./bin/opsview-deploy lib/playbooks/setup-everything.yml
  ```

3. If necessary, restore the database backup. First, identify the required backup file. Then, execute the following command to restore all databases on the server.

  ```
  gunzip -c /path/to/databases.sql.gz | mysql -u root -p
  ```

The MySQL root user password can be found in the `/opt/opsview/deploy/etc/user_secrets.yml` file.


**Note**


If you encounter `ERROR: Access to system schema 'mysql' is rejected`, refer to the [Error when restoring the MySQL database](#error-when-restoring-the-mysql-database) troubleshooting section.



Once the restore is completed, [Apply Changes](https://docs.itrsgroup.com/docs/opsview/6.11.7/configuration/apply-changes/index.html) to submit your database modifications.

## Disable the MariaDB repository and remove its packages


**Warning**


Before proceeding, ensure that your databases have been backed up to prevent data loss. For more information, see [Back up Opsview databases and configuration](https://docs.itrsgroup.com/docs/opsview/6.11.7/upgrade/upgrade-opsview/index.html#back-up-your-opsview-data-and-system).



Before upgrading to MariaDB 10.11 on a RHEL or OL system, you must disable the MariaDB repository as the upgrade process switches the package source to the OS repository.

Run the following commands on the systems that have the MariaDB database server and client packages installed.

1. Disable the MariaDB repository.

  ```
  dnf config-manager --set-disabled mariadb
  ```

2. To verify that the MariaDB repository is disabled, run the following command. The output should indicate that the MariaDB repository is `disabled`.

  ```
  dnf repolist --all
  ```

3. Once disabled, remove the MariaDB packages associated with the repository. This will only remove the specified packages and not their dependencies.

  ```
  rpm -e --nodeps MariaDB-server MariaDB-client MariaDB-common MariaDB-shared
  ```


**Note**


After removing the MariaDB packages, you might see the error `backend database-access has no server available!`. This is expected and not a cause for concern. The next steps in [Upgrade to MariaDB 10.11](https://docs.itrsgroup.com/docs/opsview/6.11.7/prerequisites/compatibility-matrix/upgrade-mariadb-10-11/index.html) will install the database server and allow you to restore your previously backed-up database.



## Error when restoring the MySQL database

MySQL 8 has security restrictions that prevent direct changes to system schemas such as `mysql`. However, a workaround can be executed to remove the affected line that drops the `mysql` database.

Run the following commands on your database host or your orchestrator, depending on where the database is located.

1. Remove this line in your `databases.sql` file:

  ```
  /*!40000 DROP DATABASE IF EXISTS `mysql`*/;
  ```

Or run the following `sed` command:

  ```
  sed -i 's/\/\*!40000 DROP DATABASE IF EXISTS `mysql`\*\/;/ /g' /path/to/databases.sql
  ```

2. Restore the databases.


**Note**


The MySQL root user password can be found in the `/opt/opsview/deploy/etc/user_secrets.yml` file.



  ```
  mysql -u root -p < /path/to/databases.sql
  ```

