• Now hiring! For SCloud Career

HOW TO SETUP UDB MYSQL AS YOUR BACKEND DATABASE FOR UHOST

November 1, 2023

Choosing MySQL as your database in a cloud environment offers several advantages, making it a popular choice for many cloud-based applications and services. To store your application records & data in a MySQL database, SCloud offers UDB MySQL which can be integrated with UHost. Before we jump into the steps for setting up UDB MySQL in SCloud console, here are some reasons to consider MySQL for cloud-based database solutions:

  • 1. Open Source and Cost-Effective

MySQL is open-source software, which means you can use it without incurring licensing fees. This can lead to cost savings, especially in cloud environments where you pay for resources based on usage.

  1. 2. Widely Supported

MySQL is one of the most widely supported relational database management systems (RDBMS). It is compatible with numerous programming languages and platforms, making it easy to integrate into various cloud-based applications.

  1. 3. Scalability

MySQL can be scaled horizontally and vertically to handle increased workloads. Many cloud providers offer tools and services for easy database scaling, ensuring your application can grow with your user base.

  1. 4. High Availability

Cloud platforms provide options for high availability and data redundancy. You can configure MySQL to work in master-slave or multi-node setups to ensure data integrity and minimal downtime.

  1. 5. Data Security

MySQL provides robust data security features, including authentication, authorization, encryption, and auditing, to protect your data in the cloud.

    1. 6. Performance

    MySQL is known for its high performance and efficient query execution. It can handle complex transactions and queries, making it suitable for a wide range of applications.

    1. 7. Community and Support

    MySQL has a large and active community, which means you can find plenty of online resources, forums, and documentation to troubleshoot issues and seek help. Additionally, commercial support options are available from various providers.

    1. 8. Replication and Clustering

    MySQL supports replication and clustering for load balancing and fault tolerance. Cloud environments make it easier to set up and manage these features.

    1. 9. Compatibility with Cloud Services

    Many cloud providers offer managed MySQL database services (e.g., Amazon RDS, Azure Database for MySQL, Google Cloud SQL) that simplify database administration, backup, and scaling.

      1. 10. Integration with Cloud Ecosystem

      MySQL can be integrated with other cloud services, such as serverless functions, storage solutions, and monitoring tools, enhancing the capabilities of your cloud-based application.

      1. 11. Flexibility

      MySQL allows you to choose storage engines that best suit your application’s requirements. InnoDB is commonly used for transactional applications, while MyISAM is suitable for read-heavy workloads.

      1. 12. Data Backups and Recovery

      Cloud platforms often include built-in backup and recovery solutions, making it easier to protect and restore your MySQL databases.

      1. 13. Global Reach

      Cloud providers offer data centers in various regions, allowing you to deploy MySQL databases closer to your users, reducing latency and improving performance.

      Here’s how to use SCloud Console to setup UDB MySQL:

          1. 1. Spin Up UHost Compute Instance (if not already done so):
          2. 1.1. Select the UHost Configuration
            1. a. Region & Availability Zones
            1. b. Configure & select model configuration (UHost Type, CPU Platform, CPU Number of Cores, Memory)
          3. Configuring UHost instance for hosting Telegram bot
            1. c. Configure & select your OS
            1. d. Configure your disk settings (Disk Type, Size)
            1. e. Configure your login settings for the UHost (password for root, login through Key Pair)
              1. f. Optional: You can configure more settings (UHost Name, bootstrap script etc. when the UHost initialized)

            1. 1.2. Select your payment preference and click ‘Purchase Now’.

            1. 2. Set Up UDB MySQL:
            2. 2.1. Go to ‘All Products’ and click on ‘MySQL UDB’.

            1. 2.2. Create Database.

            1. 2.3. Select your region, we will provision the region similar to our UHost in order to have a private connectivity.

            Choosing region for UDB MySQL

            1. 2.4. Configure your Database specs (We will keep it minimum but in case of production work load you have to go with HA option in order to achieve high availability).

            Configuring UDB MySQL specifications

            1. 2.5. Select the same VPC which your UHost instance is spun on. Then, enter a database name and the password for the root user which will be used.

            Setting login credentials for the database in UDB MySQL

            1. 2.6. Choose your payment option and click ‘Purchase Now’. Your UDB MySQL database is now set up!

            1. 3. Connect to your UDB MySQL:
            2. 3.1. Login to your UHost via ssh ubuntu@UHost_ip
            3. 3.2. Enter the commands below to install MySQL client:
              1. a. sudo apt update && sudo apt upgrade

            Installing MySQL client onto UHost

              1. b. sudo apt install mariadb-client-core-10.6

            1. 3.3. Now you can connect to your database through mysql -h udb_ip -u root -p & login via password.

            1. 3.4. You are now connected to your database as shown:

            1. 3.5. You can now start to create database and insert whatever records you want to store them in it as follows:

              Creating database and inserting records into the installed MySQL database in UHost

                  It’s important to note that the specific choice of database system depends on your application’s requirements, architecture, and your team’s familiarity with the technology. While MySQL offers numerous benefits for cloud-based applications, it’s essential to evaluate your project’s unique needs and consider alternatives like PostgreSQL, MongoDB, or cloud-native databases if they better align with your use case.

                  For any enquiries, please email enquiry@scloud.sg.

                   

                  Read other tutorials: