Ubuntu 22.04 with MySQL

This comprehensive guide covers all steps to launch and verify your MySQL instance on Ubuntu Server 22.04.

Overview: This AMI provides a pre-configured Ubuntu 22.04 LTS environment with MySQL, ready for immediate database operations. Built on the latest Ubuntu LTS release, this AMI combines the performance enhancements of Ubuntu 22.04 with MySQL’s robust features to handle a wide range of data workloads.

Step 1: Launch EC2 Instance

  1. Navigate to the MySQL on Ubuntu 22 AMI
  2. Click “Continue to Subscribe”
  3. Accept the terms and click “Continue to Configuration”
  4. Select your preferred AWS region
  5. Click “Continue to Launch”

Recommended Configuration

  • Instance Type: t3.medium or higher
  • Storage: Minimum 20 GiB (50 GiB recommended for production)
  • Security Group:
    • Port 22 (SSH)
    • Port 3306 (MySQL) – Only open to trusted IPs

Step 2: Connect to Your Instance

Secure Shell (SSH)

  1. Wait for the instance to reach the running state in your cloud console
  2. Locate the instance’s Public IP address
  3. Use an SSH client (like Terminal on macOS/Linux, or PuTTY/Windows Terminal on Windows) and your private key file
  4. The default username for Ubuntu AMIs is typically ubuntu
Command: ssh -i /path/to/your-key-pair.pem ubuntu@<Instance-Public-IP>
Username: ubuntu
Key File: /path/to/your-key-pair.pem
Instance IP: Your instance public IP

Step 3: Verify SQL Server Installation

Once connected to your Ubuntu Server, verify the MySQL service is active and operational using these methods:

Method 1: Check Package Installation Status

The SQL Server service on Linux is managed by systemd under the service name mssql-server.
  1. Run the following command in your SSH terminal:
systemctl status mysql
  1. Verification: The output should show the service status as active (running)
Service: mysql.service Status: active (running)
MySQL service status check using systemctl

Method 2: Check Package Installation Status

Verify the mysql-server package is installed on the system using the Debian Package Manager (dpkg).
  1. Run the command:
dpkg -l | grep mysql-server
  1. Verification: The output should start with ii mysql-server, which indicates the package is installed (i) and configured (i).

Expected output:

ii  mysql-server  8.0.x-0ubuntu0.22.04.x  all  MySQL database server
  • ii = Installed and configured confirms the MySQL Server package is properly installed.
MySQL Server package verification using dpkg

Method 3: Check MySQL Version

Verify the MySQL version to confirm the installation.
  1. Run the command:
sudo mysql --version
  1. Note: No password is set for the root user by default.
  2. Verification: The output should return the MySQL version information.

Expected output:

mysql  Ver 8.0.x-0ubuntu0.22.04.x for Linux on x86_64 ((Ubuntu))
  • Successful version output = MySQL client is properly installed and accessible.
MySQL version information display