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 and mysql.connector error lostintime 2 664 Oct-03-2023, 10:25 PM
Last Post: lostintime
  Mysql error message: Lost connection to MySQL server during query tomtom 6 15,990 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 6,668 Feb-05-2022, 08:25 PM
Last Post: BrandonKastning
  mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python ilknurg 3 5,589 Jan-18-2022, 06:25 PM
Last Post: ilknurg
  MYSQL.CONNECTOR ERROR DB1 8 3,829 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 2,852 Mar-24-2021, 05:45 AM
Last Post: buran
  mysql.connector Nobima 1 1,892 Apr-10-2020, 12:00 PM
Last Post: Larz60+
  How to connect Mysql databse with python and VSCode IDE madhusoodhananER 1 8,708 Oct-31-2019, 10:15 AM
Last Post: Larz60+
  Trouble retrieving dictionary from mysql.connector cursor swechsler 2 3,046 Sep-17-2019, 05:21 PM
Last Post: swechsler
  Trying to write an app to connect to a mysql DB gizmo 0 1,872 Jul-02-2019, 12:00 PM
Last Post: gizmo

Forum Jump:

User Panel Messages

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