Python Forum
Virtual Env changing mysql connection string in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Virtual Env changing mysql connection string in python
#1
I have a script that uses a Virtual Environment and has a connection to mysql where the connection string has the host as localhost or 127.0.0.1, it works without the virtual environment, however, when i run it in the venv, it changes the host to 172.18.0.1, why does that happen?

with mysql.connector.connect(**mysql_webserver_connection, charset="utf8") as conn:
        with conn.cursor(dictionary=True) as cursor:
            cursor.execute(query_string)
            results = cursor.fetchall()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python use of virtual environments bre67e49 4 736 Feb-19-2025, 04:01 AM
Last Post: Sece1967
  question about changing the string value of a list element jacksfrustration 4 2,061 Feb-08-2025, 07:43 AM
Last Post: jacksfrustration
  I cannot create a virtual environment on visual studio code using python Willem_Aucamp316 2 3,113 Nov-27-2024, 02:20 PM
Last Post: menator01
  Issues with MySql Connection EMG2024 2 953 May-29-2024, 03:11 PM
Last Post: EMG2024
  I don't know what is wrong (Python and SQL connection) shereen 3 1,333 Apr-01-2024, 08:56 AM
Last Post: Pedroski55
  No Internet connection when running a Python script basil_555 8 3,151 Mar-11-2024, 11:02 AM
Last Post: snippsat
  Best practice on using virtual environments in Python bytecrunch 6 13,948 Feb-14-2024, 03:22 PM
Last Post: snippsat
  Connection LTspice-Python with PyLTSpice bartel90 0 1,053 Feb-05-2024, 11:46 AM
Last Post: bartel90
  connection python and SQL dawid294 4 1,670 Dec-12-2023, 08:22 AM
Last Post: Pedroski55
  Mysql and mysql.connector error lostintime 2 1,670 Oct-03-2023, 10:25 PM
Last Post: lostintime

Forum Jump:

User Panel Messages

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