Skip to content

Creating a MySQL data service#

This tutorial creates an Ametnes-managed MySQL database — a private data service you reach over an Ametnes network access endpoint.

Prerequisites#

  1. A service location (see Service Location).

Networking is automatic by default

Creating a network access resource is optional. If you do not create one, Ametnes manages network access for the location and the service attaches automatically. Create your own only if you want to control exposure (see Network Access Resources).

Create the MySQL service#

Select the kind (service/mysql:<version>), tier, storage and node count. Ametnes offers MySQL 9.4 and 8.0.

  1. Navigate to the Services left menu and click New Service.
  2. Enter Name: MysqlService.
  3. Select Kind: MySql 9.4 Service.
  4. Select the Location: your data service location. Leave Network unset to let Ametnes manage it.
  5. Select the Setup Architecture (for example Basic for evaluation, or Large and above for production).
  6. Set the Admin Password for the root user; a password is generated when omitted.
  7. Click Create Service and wait for the status ready.
service.tf
resource "ametnes_service" "mysql" {
  name     = "MysqlService"
  project  = ametnes_project.project.id
  location = data.ametnes_location.location.id
  kind     = "service/mysql:9.4"
  nodes    = 1
  capacity {
    storage = 10
  }
  config = {
    "architecture"   = "Basic"
    "admin.password" = "change-me"
  }
}

output "connections" {
  value = ametnes_service.mysql.connections
}

Connect#

Use the connections returned by the service (or the console's connection panel). MySQL listens on port 3306; the host is the service's DNS name on your zone. The admin user is root; the application user is ametnes (with database ametnes).

mysql -h <host> -P <port> -u root -p

Next#