Error connecting to MySQL with Jupyter notebook

299 views
Skip to first unread message

Felipe Augusto Pereira de Figueiredo

unread,
Oct 15, 2020, 1:06:49 PM10/15/20
to Project Jupyter
Dear All, 

I'm trying toexecute the following piece of code on a Jupyter notebook running on Binder, however, I always get an error ""DatabaseError: 2003 (HY000): Can't connect to MySQL server on 'localhost' (99)"."

Could someone tell me why is this code failling?

This is the code:

import mysql.connector as mysql 
db = mysql.connect( host = 'localhost', user = "root", passwd='root' )

What could be the problem? What could I be missing? Is there any necessary configuration before opening the DB?


Thanks and Kind Regards.


Felipe Augusto

Paul Hobson

unread,
Oct 15, 2020, 6:10:59 PM10/15/20
to jup...@googlegroups.com
Hey Felipe,

My guess is that the binder instance doesn't have MySQL installed. 
-Paul

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/aa32957e-214e-47bb-abef-80f1178e54e9n%40googlegroups.com.

Felipe Augusto Pereira de Figueiredo

unread,
Oct 15, 2020, 6:13:34 PM10/15/20
to jup...@googlegroups.com
Dear Paul,

thanks for your reply. In fact, I installed mysql on tha instance of
binder, but it didn't work...
Could it be the password or user name?

Thanks,

Felipe
> To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CADT3MECZM2Lay5Z03iGOYSTL9mNAmhTess1%2BGC0y-vWhsT2hXw%40mail.gmail.com.

Paul Hobson

unread,
Oct 15, 2020, 6:19:57 PM10/15/20
to jup...@googlegroups.com
I'm not sure. Last time I set MySQL to run on even a local machine, it was an ordeal. Did you go through all the steps of starting the MySQL subprocess and all that?

Felipe Augusto Pereira de Figueiredo

unread,
Oct 15, 2020, 6:23:13 PM10/15/20
to jup...@googlegroups.com
No... I'm not an expert on mysql... all my notebooks using mysql work
fine locally. My problem is when I try to run them on the cloud.
Here on my machine I didn't need to go through any initialization
process, I just installed mysql and it started working...
> To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CADT3MEB%3DrL1kj4ZCw5jS8dE6WOiuyvsndqx-LEEfGPAw3spUVA%40mail.gmail.com.

tony....@gmail.com

unread,
Oct 17, 2020, 10:54:29 AM10/17/20
to Project Jupyter
I haven't done a demo for mysql on MyBinder, but there are some examples of how to set up postgres, mongo etc on Binder here: https://github.com/ouseful-template-repos the may provide some setup clues.
--tony

Felipe Augusto Pereira de Figueiredo

unread,
Oct 18, 2020, 8:44:28 PM10/18/20
to jup...@googlegroups.com
Dear Tony, thanks for your reply!

I've followed your tips and tried to create all those initialization
scripts, the same way you did for other databases, however, it didn't
work...
I can not start a mysql service at all...

Let me know if you happen to implement a jupyter notebook that runs
mysql on binder.

Thanks and Kind Regards,

Felipe
> To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/e26ca82b-f2e2-4900-99db-cca31ebdea22n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages