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

More than 3 years have passed since last update.

caching_sha2_passwordによるエラーでpython3.xで動かず詰まった点について

Last updated at Posted at 2020-10-21

##環境

  • OS :macOS High Sierra バージョン10.13.6
  • python :3.8.0
  • MySQL :8.0.21

##状況
python3を使って、MySQLと接続を試した。
だが、

というエラーがでて先に進めなかった。

python 2.7.16だとこれを参考にして動いたのだが、
https://qiita.com/yusuke_dev/items/7f0ca12ced72363f9448

##結論

sample.py
import mysql.connector as mydb
    conn = mydb.connect(
      host=_host,
      port=_port,
      user=_user,
      password=_passwd,
      database=_dbname,
      auth_plugin='mysql_native_password'
    )

connect関数にauth_plugin='mysql_native_password'を入れることでpython3.8.0でも動いた。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?