Extending MySQL using the Component Infrastructure – part 2: building the server

This post is the second post of a series of articles on extending MySQL with the Component Infrastructure:

In the first part of this series, we described the main idea of our new component.

Now we need to setup our development environment and compile the server from scratch.

Downloading the sources

As written in the first part, there are multiple ways to get the sources of MySQL and I use the repository on GitHub. You need then to have git installed:

$ git clone https://github.com/mysql/mysql-server.git

Then you need to prepare build directory:

$ cd mysql-server
$ mkdir BIN-DEBUG

Before being able to compile MySQL Server, you will also need to install some dependencies like CMake, a compiler, make and curses dev package on Linux, bison…

Building MySQL

$ cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST=../downloads

We specify the download of the required version of boost

$ make -j 4

-j 4 to use 4 compile threads, you might need to tune according your system.

When everything is compiled, you can run the new compiled server and test it.


The easiest way to test it, is to use mtr:

$ cd mysql-test
$ perl mtr --mem --start
worker[1] Using config include/default_my.cnf
worker[1] Port and socket path for server(s):
worker[1] mysqld.1  13000  /home/fred/workspace/mysql-server/BIN-DEBUG/mysql-test/var/tmp/mysqld.1.sock
worker[1] Waiting for server(s) to exit...

We can use MySQL Shell and the socket file to connect to our freshly compiled MySQL Server:

$ mysqlsh --sql -u root \
 -S /home/fred/workspace/mysql-server/BIN-DEBUG/mysql-test/var/tmp/mysqld.1.sock


We are now able to compile MySQL from source and start our new built server. This will be the base for our new component.

In our next article we will setup check which component services we need and create the skeleton of our component.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.