Open2
Ubuntu 22.04 LTS (AWS EC2)に、MySQL Shellをインストールする
aptでインストールする。
何はともあれ、リポジトリ情報を最新化。
sudo apt update -y
MySQL Shellのインストールの公式ページ:
aptリポジトリの確認
sudo apt search mysql-shell
# => ない...
MySQLのaptリポジトリを追加する
MySQLのaptリポジトリ追加手順の公式ページ:
基本的には、公式ページにしたがって進めるだけ...なのだが、debファイルの入手の部分のみ、CLIでやる方法が書かれていないので、補足。
1. debファイルの入手
CLIでインストールを進める場合、wgetやcurlでdebファイルを入手する訳だが、その具体的な手順は公式ページに示されていない。debファイルのURLの調べ方を以下に記載する。
上記公式ページ手順1:
- Go to the download page for the MySQL APT repository at https://dev.mysql.com/downloads/repo/apt/.
中のリンク( https://dev.mysql.com/downloads/repo/apt/ )をクリックすると、ブラウザからdebパッケージをダウンロードする雰囲気のページが開く。
【スクショ】
このページの「DOWNLOAD」ボタンを押すと、ログイン云々のページに遷移するが、そのページの下部に「No thanks, just start my download.」というリンクがある。このリンクのURLがdebファイル。
ファイル名:mysql-apt-config_0.8.30-1_all.deb
wget https://dev.mysql.com/get/mysql-apt-config_0.8.30-1_all.deb
あとは道なり
wget https://dev.mysql.com/get/mysql-apt-config_0.8.30-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.30-1_all.deb
Package configuration
┌─────────────────────────────────┤ Configuring mysql-apt-config ├─────────────────────────────────┐
│ MySQL APT Repo features MySQL Server along with a variety of MySQL components. You may select │
│ the appropriate product to choose the version that you wish to receive. │
│ │
│ Once you are satisfied with the configuration then select last option 'Ok' to save the │
│ configuration, then run 'apt-get update' to load package list. Advanced users can always change │
│ the configurations later, depending on their own needs. │
│ │
│ Which MySQL product do you wish to configure? │
│ │
│ MySQL Server & Cluster (Currently selected: mysql-8.4-lts) │
│ MySQL Tools & Connectors (Currently selected: Enabled) │
│ MySQL Preview Packages (Currently selected: Disabled) │
│ Ok │
│ │
│ │
│ <Ok> │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
sudo apt update -y
sudo apt search mysql-shell
sudo apt install -y mysql-shell
sudo reboot
インストールが成功したかどうかの確認
$ mysqlsh --version
mysqlsh Ver 8.4.0 for Linux on x86_64 - for MySQL 8.4.0 (MySQL Community Server (GPL))
MySQL ShelのUpgrade Checker Utilityで、互換性を確認する
-
JavaScriptモードで起動する
mysqlsh --javascriptこの起動方法は、
mysqlsh --helpで確認した。 -
Upgrade Checker Utilityを実行する
let rdsAddress = "<rdsAddress>"; let username = "<username>"; let password = "<password>"; util.checkForServerUpgrade(`${username}@${rdsAddress}`, {"password" : password, "targetVersion" : "8.0.28"});