2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Amazon RDS for MySQL】EC2でMySQL ShellのcheckForServerUpgradeを実行する

Posted at

概要

AWSから [アクションが必要です] Amazon RDS MySQL 8.0 は、2026 年 7 月 31 日に標準サポートを終了する予定です というメールが来ました。

これに対応するため、前回EC2上で mysqlsh コマンドが使えるようにしたので、実際に Upgrade Checker Utility を使ってアップグレードの事前確認を行いたいと思います。

↓↓ 前回の記事はこちら

環境

  • Amazon EC2
    • OS: Amazon Linux 2023
    • version: 2023.7.20250623
  • Amazon RDS for MySQL
    • version: MySQL 8.0.40

手順

mysqlsh コマンドでRDSに接続する

$ mysqlsh -hyour-db.your-region.rds.amazonaws.com -uroot -p
Please provide the password for 'root@your-db.your-region.rds.amazonaws.com': 
Save password for 'root@your-db.your-region.rds.amazonaws.com'? [Y]es/[N]o/Ne[v]er (default No): N

MySQL your-db.your-region.rds.amazonaws.com:3306 ssl  SQL >

接続できました。

util.checkForServerUpgrade() を実行する

あとは公式情報に従って実行するだけなのですが、このままutil.checkForServerUpgrade() を実行すると下記のように怒られます。

ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'util.checkForServerUpgrade()' at line 1

調べたところ、MySQL ShellはJavaScript、Python、SQLのモードがあるらしく、ターミナルの左側に出ているのが現在のモードです。

MySQL your-db.your-region.rds.amazonaws.com:3306 ssl  SQL >

ご覧の通り SQL と出ているので現在はSQLモードです。util.checkForServerUpgrade() はjs形式のフォーマットなので、JSモードに変更します。

MySQL your-host:3306 ssl  SQL > \js
Switching to JavaScript mode...
MySQL your-host:3306 ssl  JS >

変更できました。

では気を取り直して util.checkForServerUpgrade() を実行します。
ちなみに引数なしで 実行するとMySQL Shellのバージョンにアップデートを試みた場合の情報が出ます。現在のMySQL Shellのバージョンが確認したい場合は \status で確認できます。

MySQL your-host:3306 ssl  JS > \status
MySQL Shell version 8.4.6

MySQL your-host:3306 ssl  JS > util.checkForServerUpgrade()
The MySQL server at
your-db.your-region.rds.amazonaws.com:3306, version 8.0.40
- Source distribution, will now be checked for compatibility issues for upgrade
to MySQL 8.4.6. To check for a different target server version, use the
targetVersion option.

...(色々ずらずらと書いてある)...

Errors:   4
Warnings: 16
Notices:  3
ERROR: 4 errors were found. Please correct these issues before upgrading to avoid compatibility issues.

結構大量にずらーっと出たので、面倒な人はmysqlsh command interfaceを使ってファイルに出力した方が良いかもしれませんが、私は人力でコピペしました(笑)

\quit でMySQL Shellを終了できます。

MySQL your-host:3306 ssl  JS > \quit

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?