MySQL

Linux

Installation

You can get MySQL from conda-forge

conda install xeus-sql soci-mysql jupyterlab -c conda-forge

Usage

To use MySQL from inside a notebook you need to first edit your MySQL configuration file that can usually be found at /etc/mysql/my.cnf:

[server]
socket=/tmp/mysql.sock

[client]
socket=/tmp/mysql.sock

To run the example notebook you’ll need to load the dbname database or create one for yourself:

CREATE DATABASE dbname;
CREATE TABLE example ( id smallint unsigned not null auto_increment, name varchar(20) not null, constraint pk_example primary key (id) );

You will also need to create a new user and grant access to it to the newly create database. You can achieve this with the following lines in your MySQL console:

CREATE USER 'user1'@'localhost' IDENTIFIED BY 'Password123#@!';
GRANT ALL PRIVILEGES ON dbname.* TO ‘user1’@’localhost’;

Note that it might be necessary to install MySQL from different sources other than conda if you intend to manipulate users and creation of databases.

More information about MySQL can be found in the SOCI documentation.