Python Forum
Program stuck at mysql.connector.connect
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program stuck at mysql.connector.connect
#1
Hello. I have Raspberry PI 4 and have been using MYSQL on it for a while without any issues. I have decided to dedicate a standalone linux server just to handle my services and seperate them from my Raspberry PI 4. I have installed all the required modules on my linux server to install mysql, apach2 and phpmyadmin and I can access phpmyadmin on the Raspberry PI 4 browser without any issues using the IP of the server: 192.168.3.146/phpmyadmin.

However, when trying to access the mysql DB from python, it is getting stuck at mysql.connector.connect :

print("trying MYSQL")
myConnection = mysql.connector.connect(host=192.168.3.146, user='test_user', passwd='test_user123', db='test', autocommit=True)
print("Connection ID:", myConnection)
print(myConnection)
2 print statements after myConnection never gets executed which tells me that program is stuck at there. How can this be possible if I can reach that through the browser without any issues?
Reply
#2
Hello. I have Raspberry PI 4 and have been using MYSQL on it for a while without any issues. I have decided to dedicate a standalone linux server just to handle my services and seperate them from my Raspberry PI 4. I have installed all the required modules on my linux server to install mysql, apach2 and phpmyadmin and I can access phpmyadmin on the Raspberry PI 4 browser without any issues using the IP of the server: 192.168.3.146/phpmyadmin.

However, when trying to access the mysql DB from python, it is getting stuck at mysql.connector.connect :

print("trying MYSQL")
myConnection = mysql.connector.connect(host=192.168.3.146, user='test_user', passwd='test_user123', db='test', autocommit=True)
print("Connection ID:", myConnection)
print(myConnection)
2 print statements after myConnection never gets executed which tells me that program is stuck at there. How can this be possible if I can reach that through the browser without any issues?


The phpmyadmin screen on the browser looks as following:
https://ibb.co/kJmrX6Q
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mysql error message: Lost connection to MySQL server during query tomtom 6 1,818 Feb-09-2022, 09:55 AM
Last Post: ibreeden
Question Debian 11 Bullseye | Python 3.9.x | pip install mysql-connector-python-rf problems BrandonKastning 4 3,286 Feb-05-2022, 08:25 PM
Last Post: BrandonKastning
  mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python ilknurg 3 774 Jan-18-2022, 06:25 PM
Last Post: ilknurg
  MYSQL.CONNECTOR ERROR DB1 8 2,151 Jul-23-2021, 03:31 AM
Last Post: DB1
  how to connect mysql from txt 1 line goes good but not all lines in text kingceasarr 4 1,527 Mar-24-2021, 05:45 AM
Last Post: buran
  mysql.connector Nobima 1 1,183 Apr-10-2020, 12:00 PM
Last Post: Larz60+
  How to connect Mysql databse with python and VSCode IDE madhusoodhananER 1 6,432 Oct-31-2019, 10:15 AM
Last Post: Larz60+
  Trouble retrieving dictionary from mysql.connector cursor swechsler 2 1,817 Sep-17-2019, 05:21 PM
Last Post: swechsler
  Trying to write an app to connect to a mysql DB gizmo 0 1,263 Jul-02-2019, 12:00 PM
Last Post: gizmo
  Using VBA to Call a Python script causes error in pyodbc connector pcarra 1 1,850 Jun-11-2019, 04:14 PM
Last Post: pcarra

Forum Jump:

User Panel Messages

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