Python et MySQL: ValueError: source code string cannot contain null
Résolu/Fermé
A voir également:
- Python et MySQL: ValueError: source code string cannot contain null
- Mysql download - Télécharger - Bases de données
- Citizen code python - Guide
- Geometry dash python ✓ - Forum Python
- Ce programme est écrit en python ✓ - Forum Python
3 réponses
mamiemando
Messages postés
33113
Date d'inscription
jeudi 12 mai 2005
Statut
Modérateur
Dernière intervention
15 mai 2024
7 753
Modifié le 25 nov. 2021 à 18:53
Modifié le 25 nov. 2021 à 18:53
Bonjour,
Sans comment est implémenté le module
Ce devrait être :
Bonne chance
Sans comment est implémenté le module
mysql, ton code et ton import ne sont pas cohérent.
Ce devrait être :
- soit :
import mysql con = mysql.connector.connect(host="localhost", user="root", password="root", database="python_db")
- soit :
from mysql import connector con = connector.connect(host="localhost", user="root", password="root", database="python_db")
- soit:
from mysql.connector import connect con = connect(host="localhost", user="root", password="root", database="python_db")
Bonne chance
Dans les trois cas j'ai l'erreur :
Merci pour votre aide
raise errors.NotSupportedError(
mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
Merci pour votre aide
Finalement j'ai réussi avec ce code. J'ai recréé mon projet mysql et ajouté in fichier python et fait import mysql et connector, ça marché
Merci beaucoup
from mysql import connector con = connector.connect(host="localhost", user="xavier", password="xav!3", database="python_db") if con: print("Connected") else: print("Connection error")
Merci beaucoup