How I compiled MariaDB and Phidget drivers

General programming chat and advice for beginners

8 posts
by aquarat » Sun Jul 29, 2012 5:06 pm
This may seem a bit ridiculous, but both MariaDB (fork of mySQL) and the Phidget interface drivers compile with little pain on Raspbian. I say rediculous because MariaDB eats half of the RAM (in 240/16 mode).

To compile MariaDB I did this (commands executed as root) :
Code: Select all
wget ""
tar -xvf mariadb
mv mariadb-5.5.25 maria
cd maria/BUILD
cd ..
aptitude install cmake libncurses5-dev bison
make install

adduser mysql
chown -R mysql /usr/local/mysql
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql
cp support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start


Phidgets :
Code: Select all
wget ""
tar -xvf libphidget_2.1.8.20120716.tar.gz
mv libphidget- libphi
cd libphi
apt-get install libusb-dev
make install

I am by no means an expert when it comes to Linux, so please correct me if you see something I could do better. Also, I had no idea how to set the compile options for Raspbian.

P.S. These are just cleaned up commands from my .bash_history.
User avatar
Posts: 73
Joined: Thu Jul 26, 2012 2:32 pm
Location: Cape Town, South Africa
by SteveGaines » Sat Nov 03, 2012 11:07 am
Really helpful - thanks
Posts: 1
Joined: Sat Nov 03, 2012 11:04 am
by MrTime » Thu Dec 06, 2012 9:42 pm
Thanks for sharing!

Compiling MariaDB takes a long time. It's been bussy for 3.5 hours already, now at 87%. That's normal?

There isn't anybody who has a deb package for this? For Raspbian?
Posts: 3
Joined: Tue Jun 26, 2012 11:55 am
by aquarat » Thu Dec 06, 2012 10:21 pm
I just installed mysql... and so far it's working quite well for my project (Power meter reading).
User avatar
Posts: 73
Joined: Thu Jul 26, 2012 2:32 pm
Location: Cape Town, South Africa
by MrTime » Fri Dec 07, 2012 8:16 am
I got some issues trying to run it from source. Compiling and make install works fine (I guess), but the rest of the commands doens't run quite well.
Code: Select all
root@raspberrypi:/usr/local/mysql# scripts/mysql_install_db --user=mysql

FATAL ERROR: Could not find mysqld

The following directories were searched:


I can run this if I add the basedir option like so:
Code: Select all
root@raspberrypi:/usr/local/mysql# scripts/mysql_install_db --user=mysql --basedir="/usr/local/mysql"

After that I try to run mysqld:
Code: Select all
root@raspberrypi:/usr/local/mysql# /etc/init.d/mysqld start
Starting MySQL
[FAIL] Couldn't find MySQL server (/usr/bin/mysqld_safe) ... failed!

Creating a symlink at that location doesn't really work. What does (half) is the following:
Code: Select all
root@raspberrypi:/usr/local/mysql# /usr/local/mysql/bin/mysqld_safe --user=mysql


But this generates the following:
Code: Select all
root@raspberrypi:/usr/local/mysql# /usr/local/mysql/bin/mysqld_safe --user=mysql
121207 08:53:33 mysqld_safe Logging to '/var/lib/mysql/raspberrypi.err'.
121207 08:53:33 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
121207 08:53:33 mysqld_safe mysqld from pid file /var/run/mysqld/ ended

Still no running mysql server.

Error file '/var/lib/mysql/raspberrypi.err' says:
Code: Select all
Can't find messagefile '/usr/share/mysql/errmsg.sys'
Posts: 3
Joined: Tue Jun 26, 2012 11:55 am
by MrTime » Sun Dec 09, 2012 4:21 pm
I got it all working now.

The first error (FATAL ERROR: Could not find mysqld) can be fixed to change the basedir in the config file:
Code: Select all
#basedir        = /usr
basedir         = /usr/local/mysql

This will also solve the second error.

The last error is the missing error message file. Dunno how to fix this a proper way so just copied the needed file from the compile directory. I created a dir on the location (/usr/share/mysql), it wasn't there, and put my language err file in there. You can find proper err file in your compile dir:
Code: Select all
My dir:
root@raspberrypi:/opt/mariadb# cd sql/share/
charsets/            dutch/               hungarian/           norwegian-ny/        spanish/
CMakeFiles/          english/             italian/             polish/              swedish/
cmake_install.cmake  errmsg-utf8.txt      japanese/            portuguese/          ukrainian/
CMakeLists.txt       estonian/            japanese-sjis/       romanian/
CTestTestfile.cmake  french/              korean/              russian/
czech/               german/              Makefile             serbian/
danish/              greek/               norwegian/           slovak/
root@raspberrypi:/opt/mariadb# cp sql/share/english/errmsg.sys /usr/share/mysql/errmsg.sys


Now the mariadb will just run! :D
Posts: 3
Joined: Tue Jun 26, 2012 11:55 am
by Psywiped » Fri Feb 15, 2013 8:24 pm
This will save you a bunch of headache if you add it as the last command when installing MariaDB
Code: Select all
sudo cp /usr/local/mysql/support-files/my-medium.cnf /etc/mysql/my.cnf
Most likely will fix any issues your having.
Posts: 1
Joined: Fri Feb 15, 2013 8:20 pm
by kalerosky » Wed Jun 05, 2013 10:01 am
Hello everyone
I've been trying to compile mariadb 10.0.2 on my raspi debian wheezy :3
quite a mess, but finally worked out :)
Follow the steps by aquarat make the process go fine (thank you by the way...)
I've also got the issue of the messagefile (errmsg.sys) and still is, but I thought that it was the point of my problems with the server and but was not. When I start the service, it raises well, but when I tried to access thru the client, it never let me in.
I've resolved this by setting in the my.cnf where exactly was my database files by:
on [mysqld] of my.cnf
also there put the famous
I suposse that while mysqld was not finding the logins tables it would not allow me to login.
Remember that by default mariadb sock file changes to /tmp/mysql.sock, so change this directory in your php.ini file if you think to use it...
PS: excuse me about my english... and greetings form Spain!!!!
Posts: 6
Joined: Wed Jun 05, 2013 9:29 am