Installing Percona Server with TokuDB and TokuBackup from source, in CentOS 7 minimal

By | November 17, 2015

Today i want to share experience with latest Percona Server where TokuDB and TokuBakcup plugins have been added in main source.
So there is no other steps needed here to get and started.
But in recent discussion in our local community, there was a question: “How about installing MySQL on CentOS minimal”.
The reason was clear, because somebody got too many errors in fresh CentOS 7 minimal.

I want to share here full steps.
Please follow numbers:

1. Getting Source package:

[root@testing-host1 ~]# wget

tar -xvf percona-server-5.6.27-75.0.tar.gz

2. Compiling using CMAKE:

If you have read the documentation:

Compile From Source

The only command we need is:


But if we will test extensively some sort of things with our build we need to add for eg, Debug + Valgrind facilities or even Optimizer Tracer.
So our command will look like:

cmake -DCMAKE_INSTALL_PREFIX=/opt/percona-5.6.27 -DMYSQL_DATADIR=/opt/percona-5.6.27/datadir -DSYSCONFDIR=/opt/ -DWITH_SSL=system -DMYSQL_TCP_PORT=3307 -DMYSQL_UNIX_ADDR=/opt/percona-5.6.27/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=1 -DCOMPILATION_COMMENT="Shahriyar Rzayev's Percona Server" -DOPTIMIZER_TRACE=1 -DWITH_ZLIB=system -DWITH_VALGRIND=1 -DCMAKE_C_FLAGS=-DHAVE_purify -DCMAKE_CXX_FLAGS=-DHAVE_purify

3. Dealing with errors:

While running our cmake command in minimal CentOS our first error will :

-bash: cmake: command not found

Solution is just installing cmake:

yum install cmake

Second error:

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed

Obvious reason that we have not installed C Compiler yet.

yum install gcc

Rerun CMAKE and you can see our next error:

CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.


yum install gcc-c++

NOTE: Do not forget to clear CmakeLists.txt file each time after error

Next error is about missing Valgrind package of course:

CMake Error at configure.cmake:1102 (MESSAGE):
Unable to find Valgrind header files
valgrind/memcheck.h;valgrind/valgrind.h. Make sure you have them in your
include path.


yum install valgrind valgrind-devel

Another one is:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:

You can resolve this error:

yum install openssl openssl-devel

You may see another error, related to ncurses library:

CMake Error at cmake/readline.cmake:87 (MESSAGE):
Curses library not found. Please install appropriate package,

Install related package:

yum install ncurses-devel

And maybe there will be error related to readline package too:

CMake Error at cmake/readline.cmake:271 (MESSAGE):
Cannot find system readline libraries.

Install missing package:

yum install readline-devel

Also maybe you will get some:

-- Googlemock was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.

Just add -DENABLE_DOWNLOADS=1 to cmake command:

cmake -DCMAKE_INSTALL_PREFIX=/opt/percona-5.6.27 -DMYSQL_DATADIR=/opt/percona-5.6.27/datadir -DSYSCONFDIR=/opt/ -DWITH_SSL=system -DMYSQL_TCP_PORT=3307 -DMYSQL_UNIX_ADDR=/opt/percona-5.6.27/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=1 -DCOMPILATION_COMMENT="Shahriyar Rzayev's Percona Server" -DOPTIMIZER_TRACE=1 -DWITH_ZLIB=system -DWITH_VALGRIND=1 -DCMAKE_C_FLAGS=-DHAVE_purify -DCMAKE_CXX_FLAGS=-DHAVE_purify -DENABLE_DOWNLOADS=1

The result should be:

-- Successfully downloaded to /root/percona-server-5.6.27-75.0/source_downloads

Of course you may see some warnings , on of them will be:

Warning: Bison executable not found in PATH


yum install bison

From now our configuring procedure should be succeed:

-- Configuring done
-- Generating done
-- Build files have been written to: /root/percona-server-5.6.27-75.0

Now it is time to compile. Just run:

make install

Now you can start MySQL and use. But be aware that, on the way you can see another type of errors as:

[root@testing-host1 percona-5.6.27]# ./scripts/mysql_install_db --help
FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:

Installing missing perl module:

yum install perl-Data-Dumper

4. Starting MySQL
Installing system tables:

[root@testing-host1 percona-5.6.27]# ./scripts/mysql_install_db --defaults-file=/opt/percona-5.6.27/my.cnf --datadir=/opt/percona-5.6.27/datadir

With TokuDB there is a dependency on jemalloc package. So before to start Percona Server we must install jemalloc and specify path to “mysqld_safe”.

yum install epel-release
yum install jemalloc

Now we can start MySQL with jemalloc and then activate TokuDB engine and TokuBackup:

Start command:

/opt/percona-5.6.27/bin/mysqld_safe --defaults-file=/opt/percona-5.6.27/my.cnf --user=root --datadir=/opt/percona-5.6.27/datadir --socket=/opt/percona-5.6.27/datadir/mysqld.sock --port=3308 --pid-file=/opt/percona-5.6.27/datadir/ --log-error=/opt/percona-5.6.27/datadir/error.log --malloc-lib=/usr/lib64/


151117 14:35:59 mysqld_safe Adding '/usr/lib64/' to LD_PRELOAD for mysqld
151117 14:35:59 mysqld_safe Logging to '/opt/percona-5.6.27/datadir/error.log'.
151117 14:35:59 mysqld_safe Starting mysqld daemon with databases from /opt/percona-5.6.27/datadir

For enabling TokuDB and TokuBackup there is a ps_tokudb_admin tool. But due to report -> LP BUG 1517021 we can’t use this tool because we have used different my.cnf file path here.

So i just want to show how manually activate TokuDB and TokuBackup. First off all, my.cnf file should be updated. Put thp-setting=never under [mysqld_safe] catalog under my.cnf and restart MySQL.

Now connect to MySQL and run:

INSTALL PLUGIN tokudb_file_map SONAME '';
INSTALL PLUGIN tokudb_fractal_tree_info SONAME '';
INSTALL PLUGIN tokudb_fractal_tree_block_map SONAME '';
INSTALL PLUGIN tokudb_locks SONAME '';
INSTALL PLUGIN tokudb_lock_waits SONAME '';

We have activated TokuDB engine:

mysql> show engines;
| Engine | Support | Comment | Transactions | XA | Savepoints |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| TokuDB | YES | Percona TokuDB Storage Engine with Fractal Tree(tm) Technology | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
10 rows in set (0.00 sec)

For activating TokuBackup (backup solution) just add into my.cnf under [mysqld_safe]:


Again restart MySQL and install tokudb_backup plugin:

mysql> INSTALL PLUGIN tokudb_backup SONAME '';
Query OK, 0 rows affected (0.00 sec)

mysql> select plugin_name, plugin_status from information_schema.plugins where plugin_name like '%toku%';
| plugin_name | plugin_status |
| TokuDB | ACTIVE |
| TokuDB_file_map | ACTIVE |
| TokuDB_fractal_tree_info | ACTIVE |
| TokuDB_fractal_tree_block_map | ACTIVE |
| TokuDB_trx | ACTIVE |
| TokuDB_locks | ACTIVE |
| TokuDB_lock_waits | ACTIVE |
| tokudb_backup | ACTIVE |
8 rows in set (0.00 sec)

Now you are ready with Percona Server + TokuDB + TokuBackup 🙂