Report this

What is the reason for this report?

How to connect to a database on DATABASE CLUSTERS

Posted on June 4, 2020

I just created a droplet on Centos 8 and a data cluster to store MySQL database

How do I access the database from centos?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there @cpeters5,

I would recommend using the mysql client command-line tool. You could follow the steps on how to do that here:

https://digitalocean.com/docs/databases/mysql/how-to/connect/

Hope that this helps! Regards, Bobby

I solved connection problem. I forgot to update trusted sources after deleting and recreating the current droplet.

But now I get a different error code. I will post this error in a new question. Thanks!

Use the MySQL client to connect to your database with the information you’ve gathered:

mysql -h hostname_or_IP -u username -p -D database_name`

You will be prompted to enter the password for the username you specified. Replace hostname_or_IP, username, and database_name with your actual data cluster’s details.

Interact with the Database:

Once connected, you can run SQL queries to interact with your database. For example:

SHOW TABLES; SELECT * FROM table_name;`

Replace table_name with the name of the table you want to query.

Always ensure that your database credentials are kept secure and never expose them publicly. Additionally, consider using encrypted connections (SSL/TLS) when connecting to your database, especially if the connection is over the internet.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.