By cpeters5
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!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.