Python Forum

Full Version: Virtual Env changing mysql connection string in python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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()