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 Create a 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:

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 POST request:

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

You can use the following command to set the environment:

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 MariaDB Documentation.

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 MariaDB Documentation.

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

Result: You now have a ready-to-use MariaDB cluster.

Last updated