Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Connecting MySQL 5.1 container with python Error

Abierto
#423 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
docker, mysql, python
Área
databases, devops

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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)
Lenguaje dominante
JavaScript
Estrellas
3.1k
Forks
6.4k
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de docker/getting-started

Todos los issues de docker/getting-started

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.