Python Forum
Issues with MySql Connection
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issues with MySql Connection
#1
import mysql.connector

mydb = mysql.connector.connect(
    host="localhost",
    user="EMG",
    password="JAMESPaige@63"
)

print("Connected to MySQL database:", mydb.database)
been trying to run this script to connect to a MySQL Database I am trying to set up with python, it has flagged an issue with no attribute with 'connect' on line 3 which I cant get as I've all the right libraries installed. Coming at this like a beginner as I haven't used Python in 5 years
Larz60+ write May-29-2024, 07:22 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Tags added for you this time. Please use BBCode tags on future posts,
Reply
#2
I recommend reading this article for oython and mysql databases.
https://realpython.com/python-mysql/
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply
#3
Thank you so much :-)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Virtual Env changing mysql connection string in python Fredesetes 0 482 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  Mysql and mysql.connector error lostintime 2 865 Oct-03-2023, 10:25 PM
Last Post: lostintime
  Networking Issues - Python GUI client and server connection always freezes Veritas_Vos_Liberabit24 0 825 Mar-21-2023, 03:18 AM
Last Post: Veritas_Vos_Liberabit24
  Issues with "connection timed out" duckredbeard 0 1,636 Dec-31-2022, 10:46 PM
Last Post: duckredbeard
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,900 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  Python MYSQL connection does not work after 1h idle zazas321 9 7,367 Oct-07-2021, 12:02 PM
Last Post: ndc85430
  Serial connection connection issue Joni_Engr 15 8,640 Aug-30-2021, 04:46 PM
Last Post: deanhystad
  mysql connection pool? MuntyScruntfundle 0 2,120 Oct-20-2018, 07:36 PM
Last Post: MuntyScruntfundle
  mysql db connection using python sunstar20 13 12,407 Aug-04-2018, 09:08 AM
Last Post: vishalhule
  MySQL SSL Connection, Need help LordVaderXIII 3 4,059 Oct-16-2017, 10:31 PM
Last Post: LordVaderXIII

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020