Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Connecting MySQL 5.1 container with python Error

オープン
#423 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
docker, mysql, python
領域
databases, devops

調査の方向性

Start with cell 20 of the referenced jazz_final_db_migration.ipynb and compare its mysql.connector.connect call with the Docker run command for jazz_db. Verify the container's published port, credentials, and connection error, then document a reproducible connection and database-creation procedure as the done state.

索引モデルが issue の本文から書いたものです。

説明

sudo docker pull vsamov/mysql-5.1.73
Using default tag: latest
latest: Pulling from vsamov/mysql-5.1.73
30d541b48fc0: Pull complete 
8ecd7f80d390: Pull complete 
46ec9927bb81: Pull complete 
2e67a4d67b44: Pull complete 
7d9dd9155488: Pull complete 
0b0a5e453b33: Pull complete 
e8a67e96f27e: Pull complete 
1a233fe4e788: Pull complete 
679cc5f63dfc: Pull complete 
cb730efe6d35: Pull complete 
7d5b1100bc65: Pull complete 
Digest: sha256:ef03d57334761ca1e3d93cbd9f83ee1f93dafd7cac74203fbf97f20ac098c82b
Status: Downloaded newer image for vsamov/mysql-5.1.73:latest
docker.io/vsamov/mysql-5.1.73:latest

sudo docker run -d --name jazz_db -p 3307:3306 -e MYSQL_ROOT_PASSWORD=12345 vsamov/mysql-5.1.73:latest
c2913eb089d3ac553c8547d99145ddd668424434ce144ae322c5c849924419a4

sudo docker ps
CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS         PORTS                                       NAMES
c2913eb089d3   vsamov/mysql-5.1.73:latest   "/entrypoint.sh mysq…"   12 seconds ago   Up 8 seconds   0.0.0.0:3307->3306/tcp, :::3307->3306/tcp   jazz_db

I have installed a sql container using the above procedure. Now i want to connect it to python and create a new database. I used mysql-python-connector

import mysql.connector

db = mysql.connector.connect(
    host="localhost",  # or use the IP of your Docker host machine
    port=3307,          # the port you mapped for the container (3307 in your case)
    user="root",
    password="12345"
)

It is resulting in this error:

MySQLInterfaceError                       Traceback (most recent call last)
File ~/anaconda3/envs/etl/lib/python3.10/site-packages/mysql/connector/connection_cext.py:308, in CMySQLConnection._open_connection(self)
    307 try:
--> 308     self._cmysql.connect(**cnx_kwargs)
    309     self._cmysql.converter_str_fallback = self._converter_str_fallback

MySQLInterfaceError: Access denied for user 'root'@'172.17.0.1' (using password: NO)

The above exception was the direct cause of the following exception:

ProgrammingError                          Traceback (most recent call last)
/home/aidev/VectraCom/db_migration/jazz_final_db_migration.ipynb Cell 20 line 1
----> 1 db = mysql.connector.connect(
      2     host="localhost",  # or use the IP of your Docker host machine
      3     port=3307,          # the port you mapped for the container (3307 in your case)
      4     user="root",
      5     password="12345"
      6 )

File ~/anaconda3/envs/etl/lib/python3.10/site-packages/mysql/connector/pooling.py:293, in connect(*args, **kwargs)
    290         raise ImportError(ERROR_NO_CEXT)
    292 if CMySQLConnection and not use_pure:
--> 293     return CMySQLConnection(*args, **kwargs)
    294 return MySQLConnection(*args, **kwargs)
...
    314         msg=err.msg, errno=err.errno, sqlstate=err.sqlstate
    315     ) from err
    317 self._do_handshake()

ProgrammingError: 1045 (28000): Access denied for user 'root'@'172.17.0.1' (using password: NO)
主要言語
JavaScript
スター
3.1k
フォーク
6.4k
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

docker/getting-started のほかの issue

docker/getting-started の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。