Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Connecting MySQL 5.1 container with python Error

Open
#423 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
docker, mysql, python
Domain
databases, devops

Research direction

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.

Written by the indexing model from the issue text.

Description

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)
Dominant language
JavaScript
Stars
3.1k
Forks
6.4k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docker/getting-started

All issues in docker/getting-started

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.