Keine Ausgabe beim Verbinden der lokalen MySQL-Datenbank mit dem Python-ProgrammPython

Python-Programme
Anonymous
 Keine Ausgabe beim Verbinden der lokalen MySQL-Datenbank mit dem Python-Programm

Post by Anonymous »

Wenn ich die mysql.connector-Bibliothek verwende, um die lokale MySQL-Datenbank mit meinem Python-Programm zu verbinden, und wenn ich sie ausführe, gibt es in meiner Shell kein Out. Was soll ich tun, bitte helfen Sie mir.
Das ist mein Code:

Code: Select all

import mysql.connector

# Establish the connection
connection = mysql.connector.connect(
host="localhost",
user=`your text`"root",
password="password"
)

# Check if the connection was successful
if connection.is_connected():
print("Connection to MySQL DB successful")
else:
print("Connection failed")

# Close the connection
connection.close()
AUSGABE:

Code: Select all

=========== RESTART: C:\user\main.py ===========

=========== RESTART: Shell ======================
  • MySQL-Version:8.0.40
  • Python-Version:3.13.0
  • Betriebssystem: Windows 10
Ich habe versucht, das Programm auszuführen, aber es gab keine Ausgabe.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post