# Verify the Status of a MariaDB Cluster

The database will be deployed in about five minutes after the creation of your first MariaDB cluster. For more information about creating a MariaDB cluster, see [<mark style="color:blue;">Create a MariaDB Cluster</mark>](https://docs.ionos.com/sections-test/guides/databases/mariadb/api-howtos/create-mariadb-cluster).

You can manually verify whether the create request is successful because the notification mechanism is not yet available. However, you can poll the API to see when the `state` switches to `AVAILABLE`. You can use the following command:

```bash
while [[ $(curl -sXGET "https://mariadb.de-txl.ionos.com/clusters/${UUID}" -H "Authorization: Bearer ${TOKEN}" | jq -r .metadata.state) != "AVAILABLE" ]]; do
  sleep 5
  clear
  echo -e "Cluster status:\n"
  kg mariadbcluster "${UUID}" -ojsonpath='{.status.conditions}' | yq -P
  echo -e "\ncluster is not available yet, waiting 5 seconds..."
done
```

## Initialize the database and connect it to the cluster

You can connect to your MariaDB cluster soon after its creation. For example, you can connect using the `ssh` command as follows and the credentials that you set in the [<mark style="color:blue;">`POST`</mark> <mark style="color:blue;"></mark><mark style="color:blue;">request</mark>](https://docs.ionos.com/sections-test/guides/databases/mariadb/create-mariadb-cluster#request):

```bash
ssh -i .ignore.id_rsa "root@${CUSTOMER_PUBLIC_IP}"
```

You can use the following command to set the environment:

```bash
DATABASE_IP="CUSTOMER_PUBLIC_IP"
read -p "DNS Name: " DNS_NAME
```

Alternatively, you can use the following commands to connect to the database:

| Description            | Command                                                        |
| ---------------------- | -------------------------------------------------------------- |
| **via the IP address** | `mysql -u username -h "${DATABASE_IP}" --password=password`    |
| **via the DNS name**   | `mysql --ssl -u username --password=password -h "${DNS_NAME}"` |

## Manage access

You can create additional users, roles, databases, and other objects via the SQL. These operations are highly dependent on your database architecture.

The `PUBLIC` role is a special role in which all database users inherit the permissions. This is also important if you want to have a user without write permissions, since by default `PUBLIC` is only allowed to write to the `public` schema.

For more information about managing databases, refer to the [<mark style="color:blue;">MariaDB Documentation</mark>](https://mariadb.com/kb/en/database-design-example-phases-4-6-testing-operation-and-maintenance/).

### Create Users

The `CREATE USER` statement can be used to create one or more user accounts in the MariaDB database. Only users with the global `CREATE USER` privilege or the `INSERT` privilege for the MySQL database can create users. For more information, refer to the [<mark style="color:blue;">MariaDB Documentation</mark>](https://mariadb.com/kb/en/create-user/).

```sql
CREATE USER user@abc IDENTIFIED BY 'password';
GRANT SELECT ON table.t2 to 'user'@'%';
```

{% hint style="success" %}
**Result:** You now have a ready-to-use MariaDB cluster.
{% endhint %}
