📝
MySQL Server 8.4.5 LTS を Ubuntu 24.04 にインストールする
MySQLのLTSが出たそうですね。
LTSというのは Long Term Support の意味で、 長期サポート版 を意味しています。
でも、通常のように apt install
すると、 v8.0 が入るらしいです。
なので、リポジトリを更新する必要があります。
1. MySQLのリポジトリのURLを確認
まずは、リポジトリ情報を取得するためのパッケージを取得しましょう。
MySQL Community Server のダウンロードページに進みます。
バージョン情報で、以下の選択します。
(ご自身の環境に合わせてください)
- Select Version : 8.4.5 LTS
- Select Operating System : Ubuntu Linux
- Select OS Version : 24.04 (x86, 64-bit)
すると、主張強めのペンギンがDebian, Ubuntu向けにリポジトリをオススメしてきます。
これをクリックします。
右側の Download をクリックします。
画面下部の "No thanks, just start my download." にマウスを乗せると、そのリンク先URLが左下に出てきます。
この リンクをメモ します。
2. Ubuntuでリポジトリをダウンロード
リポジトリをダウンロードします。
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.34-1_all.deb
# ... (省略) ...
mysql-apt-config_0. 100%[===================>] 17.68K --.-KB/s in 0s
2025-04-28 05:07:27 (93.0 MB/s) - ‘mysql-apt-config_0.8.34-1_all.deb’ saved [18108/18108]
ダウンロードできたかファイルを確認します。
$ ls
mysql-apt-config_0.8.34-1_all.deb
3. リポジトリをインストール
dpkg
を使って、リポジトリをインストールします。
標準で 8.4 LTS が選択されているので、そのまま OK( 3
)を選択します。
$ dpkg -i mysql-apt-config_0.8.34-1_all.deb
# ... (省略) ...
1. MySQL Server & Cluster (Currently selected: mysql-8.4-lts) 3. Ok
2. MySQL Connectors (Currently selected: Enabled)
Which MySQL product do you wish to configure? 3 # <-- "3" は自分で入力
リポジトリアップデートします。
$ apt update
4. MySQLをインストール
リポジトリのインストールが完了したら、通常通りインストールします。
$ apt install mysql-server -y
5. インストールのチェック
systemctl
を使って、状態を確認します。
Active: active (running)
と書いてあれば、インストールが完了し起動しています。
$ sudo systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2025-04-28 05:32:35 UTC; 1min 50s ago
Process: 2406 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 2414 (mysqld)
Status: "Server is operational"
Tasks: 37 (limit: 6756)
Memory: 364.4M
CPU: 2.924s
CGroup: /system.slice/mysql.service
mq2414 /usr/sbin/mysqld
Apr 28 05:32:34 lark-box systemd[1]: Starting MySQL Community Server...
Apr 28 05:32:35 lark-box systemd[1]: Started MySQL Community Server.
クライアントのバージョンを確認してみます。
8.4.5 になっています。
$ mysql --version
mysql Ver 8.4.5 for Linux on x86_64 (MySQL Community Server - GPL)
サーバーのバージョンを確認してみます。
8.4.5 になっていますね。
$ sudo mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.4.5 MySQL Community Server - GPL
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Discussion