Connecting Apache Zeppelin to MySQL

Apache Zeppelin is a fantastic open source web-based notebook. Zeppelin allows users to build and share great looking data visualizations using languages such as Scala, Python, SQL, etc.

A common back end for Zeppelin in MySQL. Here are the steps needed to connect Zeppelin a remote MySQL database:

Download the MySQL Connector

The first thing to do is to download the MySQL Connector JAR. This can be downloaded at https://dev.mysql.com/downloads/connector/j/, or by using a Linux/Unix utility like wget (example downloading version 5.1.41):

wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.41.tar.gz

Once downloaded, you will have a have a compressed group of files named something like mysql-connector-java-*.tar.gz. You can extract the files in this “tarball” using tar -zxf mysql-connector-java-*.tar.gz. Files will be extracted into the a directory with a similar name. In this directory you will find the MySQL connector, which is named something like mysql-connector-java-*-bin.jar.

Move MySQL Connector into Interpreter Directory

In the Zeppelin installation directory find the directory “interpreter“. In this directory create another directory with the name of the new interpreter. In this example our interpreter will be called “mysql“, so we will create the “mysql” directory. Copy the previously extracted mysql-connector-java-5.1.41-bin.jar file into this directory.

Create a MySQL Interpreter

Now that the MySQL Connector is in place, it is time to create the MySQL interpreter. Navigate to the Zeppelin interpreter page, which in our case is at http://localhost:8080/#/interpreter. There will also be a link to the interpreters page from the Zeppelin home page.

Once on the interpreters page click the “+Create” button to create a new interpreter.

zeppelin-mysql-interpreter-config

Give your interpreter a name (like “mysql“) and select the “jdbc” interpreter group. From here you will be able to configure your MySQL JDBC connection.

Here are needed settings:

In the “Dependencies” section, you must specify the artifact of the MySQL Connector JAR that we previously downloaded. Since we downloaded version 5.1.41 in this example, the artifact is mysql:mysql-connector-java:5.1.41.

Done!

You should be ready to start using Apache Zeppelin with MySQL! Simply create a new notebook, and use “mysql” as your interpreter.

zeppelin-mysql-graph

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">