2

Being frustrated with MySQL Workbench, I'm looking for other interfaces/environments which are more convenient and closer to my current workflow using Jupyter. Here I have summarized the current working possibilities using Pandas or Jupyter magics to get nice HTML results. However, I was thinking if I could go one step further to have a native MySQL kernel for Jupyter, and it turns out that there is actually one. So I followed the instructions by installing:

 pip3 install git+https://github.com/shemic/jupyter-mysql-kernel

and creating the folders and file ~/.local/config/mysql_config.json on my mac with the blow content:

{
    "user"     : "root",
    "port"     : "3306",
    "host"     : "127.0.0.1",
    "charset"  : "utf8",
    "password" : "<password>"
}

But now when running a new NoteBook with the MySQL kernel it just returns yes for all results:

                     

which is kind of comforting, but obviously not functional! So I have created a ticket on their GitHub repo, however, given there are open tickets from a couple of years ago I'm not gonna hope my issue will be considered, at least any time soon. Now my questions are:

  • Are there any functional Jupyter or Jupyter Lab kernels for MySQL? Please consider that I have already figured the Jupyter magics out and that's not what I'm looking for.
  • Are you able to run the above kernel on other OSes or even macs? My environment is:
jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : 4.7.1
ipython          : 7.13.0
ipykernel        : 5.1.4
jupyter client   : 6.0.0
jupyter lab      : 2.0.0
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.4
traitlets        : 4.3.3
macOS Mojave version 10.14.6
Python 3.7.7
  • maybe I'm making any mistakes? for example, the path to mysql_config.json should be different on mac or the content? or if there are any workarounds to get the kernel working?

I would appreciate it if you could help me with these questions. Thanks for your support in advance.

P.S. I'm also aware of the jupyterlab-sql Jupyter Lab Extension. But firstly it is rather a GUI for tabular editing of the databases, than a real kernel where you can have cell-wise computations. And secondly, it seems to be outdated for the new Jupyter Lab versions. Installing it messed my Jupyter Lab extension manger as I have reported here.

2 Answers 2

2

We are working on a Jupyter kernel for MariaDB, first release is out with some pretty cool features. I'm pretty sure it should work on MySQL too given the history of compatibility between these two. Here is the repo of the project: https://github.com/MariaDB/mariadb_kernel Feel free to take it for a test drive, I'm really curious to see how it works for you! And please do create new Issues if you find bugs or things that you'd like to see improved. You can also give it a try without installing by clicking on the MyBinder badge in the repo readme.

1

I am working on Windows 8.1 using Anaconda. I created my virtual environment and followed the instruction to install this mysql_kernel. The problem I found is that the instructions after I installed the kernel were not clear enough. It says step1: You should set mysql host and port step2: Write your mysql code

Instead of following the step1 (setting MySQL host and port) I set up my user and my password by typing in the first cell of my Jupyter Notebook the following instruction:

mysql://user:password@localhost/databasename;

For example, if my user is root and my password is dummy and my database is northwind I should type:

mysql://root:dummy@localhost/northwind;

without any quotes. After that I was able to run my SQL code in Jupiter Noteboooks.

I hope it will help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.