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
  I don't know what is wrong (Python and SQL connection) shereen 3 371 Apr-01-2024, 08:56 AM
Last Post: Pedroski55
  No Internet connection when running a Python script basil_555 8 663 Mar-11-2024, 11:02 AM
Last Post: snippsat
  Best practice on using virtual environments in Python bytecrunch 6 859 Feb-14-2024, 03:22 PM
Last Post: snippsat
  Connection LTspice-Python with PyLTSpice bartel90 0 358 Feb-05-2024, 11:46 AM
Last Post: bartel90
  connection python and SQL dawid294 4 681 Dec-12-2023, 08:22 AM
Last Post: Pedroski55
  Mysql and mysql.connector error lostintime 2 692 Oct-03-2023, 10:25 PM
Last Post: lostintime
  Installing python packages in a virtual environment Led_Zeppelin 1 775 Aug-15-2023, 08:18 PM
Last Post: deanhystad
  Networking Issues - Python GUI client and server connection always freezes Veritas_Vos_Liberabit24 0 741 Mar-21-2023, 03:18 AM
Last Post: Veritas_Vos_Liberabit24
  Changing a string value to a numerical value using python code and a lamda function Led_Zeppelin 6 1,630 Jul-05-2022, 11:29 PM
Last Post: deanhystad
  How do I link the virtual environment of that project to the 3.9.2 version of python? Bryant11 1 1,381 Feb-26-2022, 11:15 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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