diff --git a/component/mariadb/buildout.cfg b/component/mariadb/buildout.cfg
index bc17c76fd048b45846fd8a0d3080c0119d580eef..ef38269d3afb150cef8d1efa95db5d85fa88a474 100644
--- a/component/mariadb/buildout.cfg
+++ b/component/mariadb/buildout.cfg
@@ -74,3 +74,14 @@ environment =
   CPPFLAGS=-I${groonga:location}/include/groonga -I${pcre:location}/include
   LDFLAGS=-L${groonga:location}/lib
   PKG_CONFIG_PATH=${groonga:location}/lib/pkgconfig:${groonga-normalizer-mysql:location}/lib/pkgconfig
+
+[lib_mysqludf_stem-mariadb]
+recipe = slapos.recipe.cmmi
+url = https://lab.nexedi.com/nexedi/lib_mysqludf_stem/repository/archive.tar.bz2?ref=31c59cb4b35acae73e9eaef680e5fce5e0a45ced
+md5sum = b36083e5ae9796f569b1b8f7265c7391
+pre-configure = ./autogen.sh
+configure-options =
+  --with-mysql=${mariadb:location}/bin/mysql_config
+environment =
+  PATH=${autoconf:location}/bin:${automake:location}/bin:${libtool:location}/bin:%(PATH)s
+  ACLOCAL_PATH=${libtool:location}/share/aclocal
diff --git a/stack/erp5/buildout.cfg b/stack/erp5/buildout.cfg
index 7225b1a3a7b197093baeb2bcc964ccd9908c395d..1359faadd2539f3f8688d912cc69410c3f00d4e6 100644
--- a/stack/erp5/buildout.cfg
+++ b/stack/erp5/buildout.cfg
@@ -75,6 +75,7 @@ parts +=
   poppler
   libpng
   ghostscript
+  lib_mysqludf_stem-mariadb
   mroonga-mariadb
   imagemagick
   inkscape
@@ -188,7 +189,7 @@ md5sum = dd779e54d22105702aa72cadc994d957
 [template-mariadb-initial-setup]
 <= download-base
 filename = mariadb_initial_setup.sql.in
-md5sum = b8d2d9af0c4cab45c8337aeac28d5fae
+md5sum = 6e018690909e9c833ed8745bb03b1d73
 
 [template-create-erp5-site]
 <= download-base
diff --git a/stack/erp5/mariadb_initial_setup.sql.in b/stack/erp5/mariadb_initial_setup.sql.in
index 5aabc6872facac96bac9029fd42bcfa47c4fc183..52bf1bea06bf4367db2ac4dda2a5d3ae973982db 100644
--- a/stack/erp5/mariadb_initial_setup.sql.in
+++ b/stack/erp5/mariadb_initial_setup.sql.in
@@ -1,4 +1,8 @@
 USE mysql;
+DROP FUNCTION IF EXISTS lib_mysqludf_stem_info;
+DROP FUNCTION IF EXISTS stem_word;
+CREATE FUNCTION lib_mysqludf_stem_info RETURNS STRING SONAME 'lib_mysqludf_stem.so';
+CREATE FUNCTION stem_word RETURNS STRING SONAME 'lib_mysqludf_stem.so';
 DROP FUNCTION IF EXISTS last_insert_grn_id;
 {% set mroonga = parameter_dict.get('mroonga', 'ha_mroonga.so') -%}
 {% if mroonga %}CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME '{{ mroonga }}';{% endif %}