1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Azure Data StudioからDockerで起動したMySQLに接続する

Posted at

C# + SQLServer のWinodws開発者は、SSMS(SQL Server Management Studio)をGUIツールとして使用されているケースも多いかと思います。

Azure Data Stduioは、MacOSでもSSMSのように使えるGUIツールです。

また、VSCodeと同様のショートカットや拡張機能によるカスタマイズが可能なおすすめのツールでもあります。

インストール

コチラのサイトから、Azure Data Studio をインストールします。

Azure Data Studio を起動したら、VSCodeと同様に必要な拡張機能をインストールします。

MySQL

Azure Data Studioは、初期状態で選択できる接続の種類はSQLServerのみとなっています。

SQLServer以外のデータベースは、拡張機能をインストールする必要があります。
image.png

Japanese Language Pack for Azure Data Studio

日本語化パック ※お好みでインストール
image.png

接続

MySQLの拡張をインストール後、左ペインの(+)ボタンをクリックして新しい接続を開きます。
image.png

今回は、コチラの記事を参考にDockerMySQLを起動した状態で接続をテストします。

$ docker compose ps

NAME                           IMAGE                        COMMAND                   SERVICE   CREATED          STATUS                             PORTS
docker-laravel-handson-app-1   docker-laravel-handson-app   "docker-php-entrypoi…"   app       19 seconds ago   Up 15 seconds                      9000/tcp
docker-laravel-handson-db-1    docker-laravel-handson-db    "/entrypoint.sh mysq…"   db        19 seconds ago   Up 14 seconds (health: starting)   33060-33061/tcp, 0.0.0.0:33060->3306/tcp
docker-laravel-handson-web-1   nginx:1.25.4-alpine          "/docker-entrypoint.…"   web       19 seconds ago   Up 15 seconds                      0.0.0.0:8080->80/tcp

接続設定を以下のように入力します。

  • 接続の種類:MySQL
  • サーバー名:localhost
  • パスワード:secret
  • ユーザー名:phper

image.png

[詳細設定]をクリックして、ローカルマシンに割り当てたポート番号を指定します。

  • ポート:33060

image.png

接続が成功すると、画像のようにMySQLの情報が表示されます。

image.png

php artisan migrate後に実行した結果です。

image.png

Reference

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?