Skip to main content

Get started with Aiven for MySQL®

Start using Aiven for MySQL® by creating a service, connecting to it, and loading sample data.

Prerequisites

Create a service

Configure a service

Edit your service settings if the default service configuration doesn't meet your needs.

  1. Select the new service from the list of services on the Services page.
  2. On the Overview page, select Service settings from the sidebar.
  3. In the Advanced configuration section, make changes to the service configuration.

See the available configuration options in Advanced parameters for Aiven for MySQL.

Connect to the service

  1. Log in to the Aiven Console, and go to your organization > project > Aiven for MySQL service.

  2. On the Overview page of your service, click Quick connect.

  3. In the Connect window, select a tool or language to connect to your service, follow the connection instructions, and click Done.

    mysql --user avnadmin --password=ADMIN_PASSWORD --host mysql-sakila-dev-sandbox.f.aivencloud.com --port 12691 defaultdb
tip

Check more tools for connecting to Aiven for MySQL in Connect to Aiven for MySQL.

Load a test dataset

Sakila is a sample dataset that represents a DVD rental store. It provides a standard schema highlighting MySQL features.

  1. Download the sakila database archive (tar or zip format) from the MySQL example databases page, and extract it to your desired location (for example /tmp/).

  2. From the folder where you unpacked the archive, connect to your MySQL service, create a sakila database, and connect to it:

    CREATE DATABASE sakila;
    USE sakila;
  3. Populate the database:

    source sakila-schema.sql;
    source sakila-data.sql;
  4. Verify what objects have been created:

    SHOW FULL TABLES;
    Expected output
    +----------------------------+------------+
    | Tables_in_sakila | Table_type |
    +----------------------------+------------+
    | actor | BASE TABLE |
    | actor_info | VIEW |
    | address | BASE TABLE |
    | category | BASE TABLE |
    | city | BASE TABLE |
    | country | BASE TABLE |
    | customer | BASE TABLE |
    | customer_list | VIEW |
    | film | BASE TABLE |
    | film_actor | BASE TABLE |
    | film_category | BASE TABLE |
    | film_list | VIEW |
    | film_text | BASE TABLE |
    | inventory | BASE TABLE |
    | language | BASE TABLE |
    | nicer_but_slower_film_list | VIEW |
    | payment | BASE TABLE |
    | rental | BASE TABLE |
    | sales_by_film_category | VIEW |
    | sales_by_store | VIEW |
    | staff | BASE TABLE |
    | staff_list | VIEW |
    | store | BASE TABLE |
    +----------------------------+------------+
    23 rows in set

Query data

Read data

Retrieve all the data from a table, for example, from language:

SELECT * FROM language;
Expected output
+-------------+----------+---------------------+
| language_id | name | last_update |
+-------------+----------+---------------------+
| 1 | English | 2006-02-15 05:02:19 |
| 2 | Italian | 2006-02-15 05:02:19 |
| 3 | Japanese | 2006-02-15 05:02:19 |
| 4 | Mandarin | 2006-02-15 05:02:19 |
| 5 | French | 2006-02-15 05:02:19 |
| 6 | German | 2006-02-15 05:02:19 |
+-------------+----------+---------------------+
6 rows in set

Write data

Add a row to a table, for example, to category:

INSERT INTO category(category_id,name) VALUES(17,'Thriller');
Expected output
Query OK, 1 row affected

Check that your new row is there:

SELECT * FROM category WHERE name = 'Thriller';
Expected output
+-------------+----------+---------------------+
| category_id | name | last_update |
+-------------+----------+---------------------+
| 17 | Thriller | 2024-05-22 11:04:03 |
+-------------+----------+---------------------+
1 row in set