SSL Connection Vulnerability of MySQL and MariaDB: Find out more
claudio

Introduction:

To run MariaDB from Eclipse we will actually create and install the tar.gz package resulting from compilation(See Part 2) in a separate directory, this will allow us to have MariaDB cleanly installed on a separate location and so it will be also easily possible to run it independently from Eclipse.

In these Blog posts series we assume:


yoda							as developer user
/home/yoda (or ~)	   				as home directory of developer(yoda) user
mariadb-10.0.11 					as sources version (and general prefix)
MariaDB10-test1 					as Eclipse project name
/home/yoda/playground 					as root working directory for sources, project, and installation
/home/yoda/playground/mariadb-10.0.11			as sources directory
/home/yoda/playground/mariadb-10.0.11-eclipse		as project/working directory
/home/yoda/playground/mariadb-10.0.11-linux-x86_64	as binary deployement directory

Replace accordingly the strings from this example to reflect your choices.

Section 3: "Install MariaDB in Eclipse"

3.1 CREATING THE PACKAGE

We have to ways to create the .tar.gz package

* In command line
* In Eclipse

Command line:

$ cd ~/playground/mariadb-10.0.11-eclipse
$ make package

At the end of the execution the package will be created and it should be named mariadb-10.0.11-linux-x86_64.tar.gz (i686 instead of x86_64 on 32 bit Linux)

Eclipse:

Right Click on the project name(MariaDB10-test1) and choose: Make Target-->Create,
in the popup window Add a new target just inserting the name in the first field: package, click on Ok.
Now Right Click again on the project name and choose: Make Target-->Build, choose package from the list and click Build.

Check on Eclipse Log Console that the package is being created.

At this point, either method chosen, you should have the package mariadb-10.0.11-linux-x86_64.tar.gz in the project directory (mariadb-10.0.11-eclipse).

3.2 INSTALL THE PACKAGE

We need at this point to run some commands from the shell:


$ cd ~/playground/
$ mv mariadb-10.0.11-eclipse/mariadb-10.0.11-linux-x86_64.tar.gz .
$ tar -zxvf mariadb-10.0.11-linux-x86_64.tar.gz
$ cd mariadb-10.0.11-linux-x86_64
$ scripts/mysql_install_db --basedir=`pwd` --datadir=`pwd`/data --user=yoda

If all is good now you have a working MariaDB installation in ~/playground/mariadb-10.0.11-linux-x86_64

Section 4: "Running MariaDB in Eclipse"

4.1 Create a 'Run configuration' and Run

Assuming the full path to binaries is: /home/yoda/playground/mariadb-10.0.11-linux-x86_64.

Right Click on the project (or open the Run menu) and click on Run As-->Run configurations...,
Select C/C++ Application, right click and choose New.

Compile only two parameters in the respective tabs, Main and Arguments

Main (tab):
Click Browse and select /home/yoda/playground/mariadb-10.0.11-linux-x86_64/bin/mysqld

Arguments (tab):
--basedir=/home/yoda/playground/mariadb-10.0.11-linux-x86_64 --datadir=/home/yoda/playground/mariadb-10.0.11-linux-x86_64/data --plugin-dir=/home/eclipse/10011/lib/plugin --user=yoda --log-error=error.log --pid-file=mysql.pid --socket=10011.sock --port=10011

Click on Apply and then you can click on Run, as usual check the progress in the Eclipse log Console,

A [Warning] about the user switch is totally fine, if you got only one warning about the user it means you probably managed to run succesfully MariaDB from Eclipse.

4.2 Checking if MariaDB is running

At this point we want to check if MariaDB is actually running:

$ cd ~/playground
$ cd mariadb-10.0.11-linux-x86_64
$ bin/mysql -uroot -h127.0.0.1 -P10011 -e"SHOW GLOBAL VARIABLES LIKE 'version'"

If you see the output:

+---------------+-----------------------+
| Variable_name | Value |
+---------------+-----------------------+
| version | 10.0.11-MariaDB-debug |
+---------------+-----------------------+
1 row in set (0.01 sec)

Your MariaDB is happily running, Congratulations!

In the next Part 4 you will learn how to debug MariaDB under Eclipse.
You may also want to review Part 1 and Part 2.

This is the end of Part 3.

Pól Ua Laoínecháin

Hi, just a note about the pages on compiling withe Eclipse. When the binary is compiled according to the instructions, the mysqld binary is called mysqld-debug and the mysql_install_db script fails. It requires a rename.
claudio

Hello Pól, Thanks for your note! Which mysql version did you try? It seems that MySQL creates the binary mysqld-debug, while MariaDB creates the binary mysqld. Both are the -debug build, but the name of the binary file is different. Good catch again, I will add this extra note too. Thanks! Claudio
Pól Ua Laoínecháin

Hi Claudio, I appear to have got it running, but I don't seem to be able to execute bin/mysql -uroot -h127.0.0.1 -P10011 -e"SHOW GLOBAL VARIABLES LIKE 'version'" There are a couple of other things - could you send me an email (linehanp __@__ tcd _dot_ ie) and I'll explain? It's too long for a comment. The version of MySQL that I'm using is 5.6.19-debug. I'm very interested in getting this up and running (and then start debugging!).
claudio

Hello Pól! It would be extremely interesting for anyone who faces your same problems to be able to follow, do you think it is possible to continue here? Please let me know. Best Regards
Pól Ua Laoínecháin

Hi Claudio, and thanks for your interest. Of course I agree about others following. I'll post here, but I'll have to post links to other stuff (on Pastebin and others - I'll set up a Dropbox drop or similar for screenshots - maybe the lot, since Pastebin is time limited). The reason I suggested email was to be able to send you these, but a URL is just as good and accessible to everybody! The only problem is that my sister is getting married tomorrow and I'll be busy over the weekend. I'll get back to you next week!
claudio

Hi Pól, If you google for "image upload site" you will find many options! If it is not too complicated it would be nice to share with everyone your work, I am sure many people will find it useful. I want to thank you again for your interest and wish you all the best for your sister's wedding! Cheers
sqlzhang

These articles helped me a lot! Waiting for Part 4.
claudio

Hello sqlzhang! Thanks so much for sharing your opinion, Part 4 is already available at: <A HREF=http://www.skysql.com/blogs/claudio/compiling-debugging-mariadband-mysql-eclipse-scratch-part-4-profiling-eclipse-preparat>Part 4</A>. It is the first of two parts (Part 4&5) dedicated to the introduction to profiling (with OProfile) in Eclipse. Thanks again for sharing! Claudio

Newsletter Signup

Subscribe to get MariaDB tips, tricks and news updates in your inbox: