41から始めました

文字通り41歳から始めたブログです。DB(MySQL)を使ってお仕事してるので、DB周りの話を中心に最近始めたこととかをTwitterのノリで書いています。なお、本サイトにおいて示されている見解は私個人の見解であり、所属団体や組織を代表するものではありません。

ゆるふわ MySQL AIインストール手順

はじめに

なんか僕らの大好きな(?)ニプンがMySQL AIについて紹介してたんで、じゃ、名前もアレだし、とりあえず手を出してみっか!と軽い気持ちで踏み込んでしまいました。

前提条件/必要要件

項目 内容
サポートされる OS Oracle Linux 8、Red Hat Enterprise Linux 8
ハードウェア要件 CPU:32 論理/仮想コア以上、メモリ:128 GB、ストレージ:512 GB
ライセンス MySQL Enterprise Edition のライセンスが必要
管理者権限 sudo が使えるユーザーで操作できること
TLS 証明書 独自の TLS/SSL 証明書/鍵を利用するなら MySQL の要件を満たすもの。ない場合はセルフサイン証明書を生成可能。

ここで残念なのがEEのライセンスが必要なところだろう…。CEでも試させ、おっと、誰か来たようだ…

インストール手順

以下に、GUI モードおよびコマンドラインモードの二種類のインストール方法を示します。

GUICLI共通 インストール作業

GUIモードおよびコマンドラインモードでも共通部分があるため、まずその部分を記載します。

1. RPM バンドルを取得

My Oracle Support (MOS) または Oracle Software Delivery Cloud から MySQL AI の RPM バンドルをダウンロードする。

Oracle Software Delivery Cloudからダウンロードのイメージ

https://downloads.mysql.com/docs/mysql-ai-9.4-en.pdf

2. バンドルを展開

$> tar -xvf mysql-ai-version.distro.arch.rpm-bundle.tar

もしくは

$> unzip V1051679-01.zip

解凍した後はこんな風になる

$ ls -ltrh
total 12G
-rw-r--r-- 1 takiida common  42M Aug 26 15:26 mysql-ai-client-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 725K Aug 26 15:26 mysql-ai-common-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common  16M Aug 26 15:26 mysql-ai-client-plugins-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common  23M Aug 26 15:26 mysql-ai-devel-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 2.3M Aug 26 15:26 mysql-ai-icu-data-files-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 1.9G Aug 26 15:26 mysql-ai-heatwave-ml-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 4.7M Aug 26 15:26 mysql-ai-libs-compat-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 4.3M Aug 26 15:26 mysql-ai-libs-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 1.9G Aug 26 15:26 mysql-ai-llm-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 100M Aug 26 15:26 mysql-ai-rpdheatpump-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 101K Aug 26 15:26 mysql-ai-selinux-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 230M Aug 26 15:26 mysql-ai-rpdserver-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 531M Aug 26 15:27 mysql-ai-server-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 1.2M Aug 26 15:27 mysql-ai-setup-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 358M Aug 26 15:27 mysql-ai-server-debug-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 238M Aug 26 15:27 mysql-ai-studio-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 3.8M Aug 26 15:27 mysql-commercial-backup-9.4.1-1.5.1.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 467M Aug 26 15:27 mysql-ai-test-9.4.1-1.2.el8.x86_64.rpm
-rw-r--r-- 1 takiida common  68M Aug 26 15:27 mysql-router-commercial-9.4.1-1.5.1.el8.x86_64.rpm
-rw-r--r-- 1 takiida common 116M Aug 26 15:27 mysql-shell-commercial-9.4.1-1.1.el8.x86_64.rpm
-rw-r--r-- 1 takiida common   64 Sep  3 09:44 README.txt
-rw-r--r-- 1 takiida common 5.9G Sep 17 10:48 V1051679-01.zip

ちょっとヘルプを見てみる。

$ sudo mysql-ai-setup --help
usage: mysql-ai-setup [-h] [--cli] [--skip-install] [--script-only] [--datadir D] [--skip-requirements] [--mysql-root-user N] [--mysql-root-password P] [--mysql-root-allow-remote-connections] [--skip-mysql-studio]
                      [--install-mysql-studio] [--mysql-studio-port P] [--skip-mysql-shell-gui] [--install-mysql-shell-gui] [--mysql-shell-gui-port P] [--skip-mysql-router] [--install-mysql-router]
                      [--mysql-router-port P] [--mysql-router-jwt-secret P] [--secure-file-priv P] [--mysql-server-tls-certificate P] [--mysql-server-tls-private-key P] [--skip-ai-encryption]
                      [--ai-plugin-certificate P] [--ai-plugin-private-key P] [--ai-plugin-common-name P] [--ai-services-certificate P] [--ai-services-private-key P] [--ai-services-common-name P]
                      [--ai-plugin-create-self-signed-certificate CN] [--ai-services-create-self-signed-certificate CN] [--mysql-studio-https-certificate P] [--mysql-studio-https-private-key P]
                      [--mysql-shell-https-certificate P] [--mysql-shell-https-private-key P] [--mysql-router-https-certificate P] [--mysql-router-https-private-key P]

Install MySQL AI.

options:
  -h, --help            show this help message and exit
  --cli                 run in command line mode only
  --skip-install        do not apply any of the choices made
  --script-only         Do not install, only output the steps as a shell script
  --datadir D           The location of the MySQL data directory
  --skip-requirements   ignore unmet system requirements
  --mysql-root-user N   the user name of the administrative MySQL user
  --mysql-root-password P
                        the password of the administrative MySQL user
  --mysql-root-allow-remote-connections
                        allow remote connections as the administrative MySQL user
  --skip-mysql-studio   do not install MySQL Studio
  --install-mysql-studio
                        install MySQL Studio
  --mysql-studio-port P
                        the port to use for the MySQL Studio https server
  --skip-mysql-shell-gui
                        do not install the MySQL Shell GUI service
  --install-mysql-shell-gui
                        install the MySQL Shell GUI service
  --mysql-shell-gui-port P
                        the port to use for the MySQL Shell GUI https server
  --skip-mysql-router   do not install the MySQL Router service
  --install-mysql-router
                        install the MySQL Router service
  --mysql-router-port P
                        the port to use for the MySQL REST service
  --mysql-router-jwt-secret P
                        the JWT secret to use for MySQL Router
  --secure-file-priv P  the path to configure for secure file access by mysqld and vector store
  --mysql-server-tls-certificate P
                        the certificate for encrypted connections to use by MySQL Server
  --mysql-server-tls-private-key P
                        the private key for encrypted connections to use by MySQL Server
  --skip-ai-encryption  disable encryption between MySQL Server and the AI&ML services
  --ai-plugin-certificate P
                        the certificate for encrypted connections to use by the MySQL Server AI&ML plugin
  --ai-plugin-private-key P
                        the private key for encrypted connections to use by the MySQL Server AI&ML plugin
  --ai-plugin-common-name P
                        the common name to use by the MySQL Server AI&ML plugin
  --ai-services-certificate P
                        the certificate for encrypted connections to use by AI&ML services
  --ai-services-private-key P
                        the private key for encrypted connections to use by AI&ML services
  --ai-services-common-name P
                        the common name to use by AI&ML services
  --ai-plugin-create-self-signed-certificate CN
                        create a self-signed certificate for the AI plugin
  --ai-services-create-self-signed-certificate CN
                        create a self-signed certificate for the AI services
  --mysql-studio-https-certificate P
                        the certificate for https connections to use by MySQL Studio
  --mysql-studio-https-private-key P
                        the private key for https connections to use by MySQL Studio
  --mysql-shell-https-certificate P
                        the certificate for https connections to use by the MySQL Shell GUI
  --mysql-shell-https-private-key P
                        the private key for https connections to use by the MySQL Shell GUI
  --mysql-router-https-certificate P
                        the certificate for https connections to use by the MySQL REST Service
  --mysql-router-https-private-key P
                        the private key for https connections to use by the MySQL REST Service

Copyright (c) 2025, Oracle and/or its affiliates.

3. インストーラをインストール

$> sudo dnf localinstall mysql-ai-setup-version.distro.arch.rpm

上の例だと

$ sudo dnf localinstall mysql-ai-setup-9.4.1-1.2.el8.x86_64.rpm
Last metadata expiration check: 1 day, 11:33:12 ago on Tue 16 Sep 2025 04:25:27 PM CEST.
Dependencies resolved.
============================================================================================================================================================================================
 Package                                         Architecture                            Version                                        Repository                                     Size
============================================================================================================================================================================================
Installing:
 mysql-ai-setup                                  x86_64                                  9.4.1-1.2.el8                                  @commandline                                  1.2 M

Transaction Summary
============================================================================================================================================================================================
Install  1 Package

Total size: 1.2 M
Installed size: 4.8 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                    1/1
  Installing       : mysql-ai-setup-9.4.1-1.2.el8.x86_64                                                                                                                                1/1
  Running scriptlet: mysql-ai-setup-9.4.1-1.2.el8.x86_64                                                                                                                                1/1
  Verifying        : mysql-ai-setup-9.4.1-1.2.el8.x86_64                                                                                                                                1/1

Installed:
  mysql-ai-setup-9.4.1-1.2.el8.x86_64

Complete!

これで mysql-ai-setup コマンドが使えるようになる。

A. GUI インストール作業

まずはGUIインストール方法を以下記載します。(CLIで行う人はBまでスキップ)

(実は自分はGUI未タッチです。ドキュメント等から転記してますが、間違ってたらごめんね)

4. GUI インストーラを起動

展開した RPMディレクトリで、以下を実行:

$> sudo mysql-ai-setup

GUI モードでのインストールが始まる。

5. GUI による設定ページを順に進める

GUI によって以下のような設定を順番に行う:

ページ 内容
Introduction 続行 (“Continue”) をクリック。
System Requirements ハードウェア/ソフトウェア要件のチェック。足りない場合は“Continue Anyway”かインストール中止を選択。
User & password root ユーザー名とパスワードを設定。validate_password コンポーネントのポリシー(少なくとも “MEDIUM”)を満たす必要あり。ローカル接続のみ許可するかなどを選択。
MySQL Studio ウェブ GUIMySQL Studio” のインストール/ポート番号設定(デフォルトは 8080)
Router & Shell MySQL Shell GUI**(Workbench)や MySQL Router / MySQL REST Service の設定。どちらを入れるか選択。ポート番号の変更可能。 JSON Web Token のシークレット設定。
Vector Store ドキュメントなどをロードするベクトルストアのディレクトリを指定。 secure_file_priv システム変数で mysqld がそのディレクトリから安全にインポートできるよう設定されている必要あり。デフォルトは /var/lib/mysql-files。存在しなければ作成される。
Certificates コンポーネント間の TLS 通信のための証明書/鍵を指定。証明書・鍵ファイルは root によって読み込め、パスフレーズなし。CN(Common Name)などを確認。指定しなければセルフサイン証明書が生成される。)
Finalize Installation 設定内容を最終確認し、ポートの重複など問題がなければインストール開始。インストール完了後は各コンポーネントの URL/エンドポイントが表示される。

6. インストール完了後

GUI が終了すると、MySQL Studio や Shell GUI、REST Service のエンドポイントの情報が出力されるのでメモしておく。

B. コマンドラインCLI)インストール作業

こちらはコマンドラインCLI)によるインストールです。(Aで作業をしている場合は不要)

GUI を使いたくない、サーバー環境などで GUI が使えない場合はこの方法で行います。

4. mysql-ai-setup を CLI モードで起動:

$> sudo mysql-ai-setup --cli [オプション]

主なオプションについては以下参照:

オプション 内容
--skip-install 実際のインストールはせず、要件チェックやオプション指定のテストのみ行う。
--skip-requirements 最低要件を満たしていなくてもインストールを強行する。 ※性能や動作保証に問題が出る可能性あり。
--mysql-root-user=ユーザー名 root ユーザー名指定
--mysql-root-password=パスワード root パスワード指定(validate_password の MEDIUM レベルを遵守)
--mysql-root-allow-remote-connection root に対してローカル以外からの接続を許可する設定
--install-mysql-studio / --skip-mysql-studio MySQL Studio の導入/スキップを指定
--mysql-studio-port=ポート番号 MySQL Studio 用ポートの指定
--install-mysql-shell-gui / --skip-mysql-shell-gui Shell GUI(Workbench 相当)を入れるかどうか指定
--mysql-shell-gui-port=ポート番号 Shell GUI 用ポート指定
--skip-mysql-router / --mysql-router-port=ポート番号 REST サービスを含む Router の導入・ポート指定
--mysql-router-jwt-secret=シークレット REST Service の JWT シークレットを指定。指定しないとランダムに生成される。
--secure-file-priv=ディレクトリ ベクトルストア用ディレクトリ。mysqld の secure_file_priv と整合性を持たせる必要あり。
TLS 証明書/鍵指定オプション コンポーネントの通信を暗号化したい場合に証明書や鍵をパラメータで渡す。ファイル/バンドル/秘密鍵など。パスフレーズ保護なし。

CLIによるインストール例

$> sudo mysql-ai-setup --cli \
  --mysql-root-user=root \
  --mysql-root-password="StrongPassw0rd!" \
  --mysql-root-allow-remote-connection \
  --install-mysql-studio \
  --mysql-studio-port=8080 \
  --install-mysql-shell-gui \
  --mysql-shell-gui-port=8081 \
  --mysql-router-port=6446 \
  --mysql-router-jwt-secret="MyJWTSecret123" \
  --secure-file-priv=/var/lib/mysql-files

しかしである。

System requirements not met.
Disk Space:   168.2 G < 512 G!
Note: The requirements check can be disabled with --skip-requirements.
Installation cancelled.

そう、そんなにでかい領域簡単に手に入らないわけで。。。どーせ、テストだと思い、言われるがままに--skip-requirementsをつけてみると今度は

No certificates for communication between MySQL Server and the ML and AI subsystems.
Encryption between these components needs to be disabled explicitly (--skip-ai-encryption).
Installation cancelled.

証明書ですか。今から作るのめんどいな(オイ!)。よし、--skip-ai-encryptionしちゃおう!ってんで、自分は先に進めちゃいました。

みんなはマネしちゃだめですよ?w

5. CLI モードでインストール実行後、同様にエンドポイントやサービスが起動し、設定内容が有効になる。

完了すると、こんな感じのメッセージが出ます。

==============================================================================
Installation finished.
==============================================================================

To access MySQL Studio, navigate to the following
URL in a web browser:

    https://honyarara-hogehoge.com:8080/

To access a SQL shell for this MySQL AI instance, navigate to the following
URL in a web browser:

    https://honyarara-hogehoge.com:8081/


==============================================================================

https://honyarara-hogehoge.com:8080/のほうにつなぐとMySQL Studioである。AI Chatなどもこっちにあるし、ドキュメントにそれぞれの使い方は書いてあるようだ。

8080

しかし、

https://honyarara-hogehoge.com:8081/のほうにつなぐと、なんとMySQL SHELL Workbenchなるものが!

8081
詳細な情報はどこにもない。(名前だけMySQL AIのドキュメント上にあるが、使い方などはさっぱり。)今後に期待しよう…。

作業後の確認ポイント

  • インストール後、以下が期待どおりに動作するか確認:
    1. MySQL Server が起動していること(systemctl status mysqld 等)
    2. MySQL AI プラグインや Machine Learning Service コンポーネントがロードされているか
    3. REST サービス、Shell GUI、Studio などをブラウザからアクセス可能か(設定したポートおよび URL)
    4. TLS 通信を有効にした場合、証明書が正しく読み取られているか、ブラウザなどで HTTPS 接続がエラーにならないか
    5. ベクトルストアのディレクトリの読み書き権限、セキュリティ設定が正しいか
  • 性能テストを行い、必要ならリソース(CPU、メモリ、ディスク)のモニタリングを実施。
  • セキュリティ面で、不要な公開ポートを閉じる、ルートユーザー/管理者ユーザーのリモートアクセス制限を確認する。

おわりに

MySQL EEのライセンスが無いと遊べない、RHEL系8のみ、OSリソース結構デカい(まあ、AI動かすんやし、しゃあなし?)という感じであんまり気軽に遊べないのだが、これらすべてクリアできる人は試してみて欲しい。

参照情報

https://dev.mysql.com/doc/mysql-ai/9.4/en/

https://downloads.mysql.com/docs/mysql-ai-9.4-en.pdf

https://dev.mysql.com/doc/dev/mysql-studio/latest/#my-files