# MySQL 8.4.x on Amazon Linux

This article provides a comprehensive guide for installing **MySQL version 8.4.x** on an **Amazon Linux 2023** system. It covers the necessary prerequisites, step-by-step installation process, initial configuration, and performance optimization settings recommended by OvalEdge.

## Prerequisites

Ensure the following before proceeding:

* A user account with **sudo privileges**
* A **stable internet connection**
* Access to the **MySQL VM** where the installation will take place

## Installation

1. **Update System Packages**
   * Log in to the MySQL virtual machine (VM) and run the following command to update the package manager:

     ```bash
     sudo yum update -y
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FQ9aNfPEOlAri9yKGlepp%2F0.jpg?alt=media&#x26;token=5dbbdf44-5735-4caa-b9a4-a4413f51ec8c" alt=""><figcaption></figcaption></figure>

2. **Install Required Utilities**
   * Official MySQL RPM package link:\
     [https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm](https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm?utm_source=chatgpt.com)
   * Install the **yum-utils** package for managing repository configurations:

     ```bash
     sudo yum install -y yum-utils
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FITuAvyfByy4TPDcPxcRu%2F1.jpg?alt=media&#x26;token=adb20749-c304-4242-b70e-ae96234f3b0f" alt=""><figcaption></figcaption></figure>

3. **Download and Install the MySQL Yum Repository**
   * Download the MySQL 8.4 Community Repository RPM package:

     ```bash
     wget https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FcG4liwe8g5zDaCThO64V%2F2.jpg?alt=media&#x26;token=4bb23615-5e6e-41e4-8b0d-8704260ef65b" alt=""><figcaption></figcaption></figure>
   * Install the repository package:

     ```bash
     sudo yum localinstall -y mysql84-community-release-el9-1.noarch.rpm
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FehEda8AJXfx9D8Ohyb1U%2F3.jpg?alt=media&#x26;token=8c7e9078-aafe-41c2-ac92-3d66700be721" alt=""><figcaption></figcaption></figure>

4. **Install MySQL Server**
   * Install the MySQL 8.4.x community server package:

     ```bash
     sudo yum install -y mysql-community-server
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FUHuXVW75gE96lXG2Q45l%2F4.jpg?alt=media&#x26;token=6fc9e98a-d050-44b0-81f9-4da5021a7365" alt=""><figcaption></figcaption></figure>

5. **Start and Enable MySQL Service**
   * Start the MySQL service and enable it to start at boot using the following commands:

     ```bash
     sudo systemctl start mysqld
     sudo systemctl enable mysqld
     sudo systemctl status mysqld
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FplaMwvblKXHd5rHQNgiP%2F5.jpg?alt=media&#x26;token=d386a2b5-6128-421a-8719-817bb6dad79b" alt=""><figcaption></figcaption></figure>

6. **Retrieve Temporary Root Password**
   * MySQL generates a temporary root password upon initial startup. Retrieve it from the log file:

     ```bash
     sudo vi /var/log/mysqld.log
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FlIeTl8F7W1K29M9EMxTq%2F6.jpg?alt=media&#x26;token=c7c11822-aa69-4e8d-b552-80ab1ef5c397" alt=""><figcaption></figcaption></figure>
   * Search for the line containing **temporary password**.<br>

7. **Secure MySQL and Set Permanent Root Password**
   * Log in to the MySQL shell using the temporary password:

     ```bash
     mysql -u root -p
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FdvvL0fqPARHnpSYshT70%2F7.jpg?alt=media&#x26;token=273f2ace-5214-4680-acde-1669a134c3ad" alt=""><figcaption></figcaption></figure>
   * Execute the following SQL commands to set a new root password and secure the installation:

     ```sql
     ALTER USER 'root'@'localhost' IDENTIFIED BY '<new_secure_password>';
     DELETE FROM mysql.user WHERE User='';
     DROP DATABASE IF EXISTS test;
     DELETE FROM mysql.db WHERE Db='test' OR Db='test_%';
     FLUSH PRIVILEGES;
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2F08IyXqbmukyk3qteKstn%2F8.jpg?alt=media&#x26;token=5ac94f37-a521-48c7-94c6-0a8cd3bc27e2" alt=""><figcaption></figcaption></figure>

     <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>Replace <code>&#x3C;new_secure_password></code> with a strong password that complies with MySQL's password policy.</p></div>

8. **Configure MySQL Parameters**
   * Edit the MySQL configuration file to apply recommended settings:

     ```bash
     sudo vi /etc/my.cnf
     ```
   * Add or update the following parameters:

     ```ini
     max_binlog_size = 1G
     binlog_expire_logs_seconds = 2592000
     group_concat_max_len = 4294967295
     max_connections = 600
     max_allowed_packet = 1G
     bind-address = 0.0.0.0
     innodb_buffer_pool_size = 8G
     ```

     \
     *Sample Reference Screenshot:*

     <div align="left"><figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2F1nTWLEOHLH1T2yCgIc2m%2F9.jpg?alt=media&#x26;token=f7d3b7c5-0f01-4921-8fcc-e6988d07d09f" alt=""><figcaption></figcaption></figure></div>

     <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><ul><li>Set <code>bind-address = 0.0.0.0</code> only if the MySQL server and client applications are on separate machines.</li><li>Configure <code>innodb_buffer_pool_size</code> to approximately <strong>50–70% of available system RAM</strong> for optimal performance.</li></ul></div>

     <br>

9. **Restart MySQL Service**
   * Apply the configuration changes by restarting the MySQL service:

     ```bash
     sudo systemctl restart mysqld
     sudo systemctl enable mysqld
     ```

     \
     *Sample Reference Screenshot:*

     <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2F8Bh0u9jt8tKKTqriIHGL%2F10.jpg?alt=media&#x26;token=288c90ad-6876-449d-8428-348ab14af398" alt=""><figcaption></figcaption></figure>

10. **Create OvalEdge Database**
    * Once the above steps are completed, download the **MasterScripts file** provided by the OvalEdge team in the MySQL VM, as shown below.

      <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FVSmOWodrbuC51Ll1EmCv%2F11.jpg?alt=media&#x26;token=042220af-cefa-42df-afa4-ae3f431074c5" alt=""><figcaption></figcaption></figure>
    * Transfer the **MasterScripts SQL file** (provided by OvalEdge) to the MySQL virtual machine.
    * Log in to MySQL:

      ```bash
      mysql -u root -p
      ```
    * Run the MasterScripts file using the `source` command:

      ```sql
      source /path/to/MasterScripts.sql;
      ```

      \
      *Sample Reference Screenshot:*

      <figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FHd0VzP3RpiDqXbSl6Cim%2F12.jpg?alt=media&#x26;token=55d0ce8b-9f43-4280-aba7-55ceb771075a" alt=""><figcaption></figcaption></figure>
    * Verify the database creation:

      ```sql
      SHOW DATABASES;
      ```

      \
      *Sample Reference Screenshot:*

      <div align="left"><figure><img src="https://1813356899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTnkoJQml0pok9awFDhx%2Fuploads%2FcWogKxR27F1FsjkeTc9n%2F13.jpg?alt=media&#x26;token=2c39614f-de90-4fca-a044-279fa1c5fe1b" alt=""><figcaption></figcaption></figure></div>

      <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>Confirm that the <strong>ovaledgedb</strong> database is listed.</p></div>

***

Copyright © 2025, OvalEdge LLC, Peachtree Corners, GA, USA.
