Can I connect to my Railway MySQL in jupyter lab with python?

I'm trying to get the data from my MySQL db into a csv and analyze it. Can't find a resource to do so. I tried installing mysql-connector-python and using import mysql.connector and using db = mysql.connector.connect( host = " ", user = " ", password = "" ) but it keeps saying Can't connect to MySQL server on "...railway.app"
Solution:
you would either need to use the database url variable, or all all the other environment variables available for your database
Jump to solution
5 Replies
Percy
Percy8mo ago
Project ID: N/A
Hosna Qasmei
Hosna Qasmei8mo ago
N/A
Solution
Brody
Brody8mo ago
you would either need to use the database url variable, or all all the other environment variables available for your database
Hosna Qasmei
Hosna Qasmei8mo ago
ah okay gotcha let me try it yay cool it works, I just needed to add port and database thank you!
Brody
Brody8mo ago
no problem!