LoginSignup
1
0

More than 1 year has passed since last update.

wsl2を使ってMySQLに接続できないときにパスワードを確認する

Last updated at Posted at 2022-10-19

wsl2とDocker Desktopを使ってMySQLの環境構築を行いました。
wsl2からMySQLへの接続の際に下記のエラーができました。

$ mysql -u root -p -h 0.0.0.0 -P 3306
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '0.0.0.0' (111)

mysqlへのログインはubuntuのrootパスワードではなく、今回、rootでログインを試みているためmysqlのrootパスワードを使用します。
mysqlのrootパスワードの確認はDocker Desktopの該当のコンテナーのInspectに記載されています。

スクリーンショット 2022-10-19 165412.png

mysqlのrootパスワードを使ったところログインできました

$ mysql -u root -p -h 0.0.0.0 -P 3306
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 38
Server version: 8.0.31 MySQL Community Server - GPL

Copyright (c) 2000, 2022, 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>

参考
https://qiita.com/T-Ooshio83/items/517c905410d07bfe4f71#%E5%AE%9F%E6%96%BD%E7%92%B0%E5%A2%83

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