MariaDB refuses to stay confined to install directory

I've been struggling with this off and on for weeks. I need a contained MariaDB install running in the home directory.

My most recent attempt (and what would be my preferred method) is compiling from source. No matter what I do though MariaDB insists on trying to create /var/run/mysqld/mysqld.sock on every run and fails.

I compiled it from source with --prefix pointing to my home directory. I ran mysql with --basedir and --defaults-file. The defaults-file I used contains the location of my mysql.sock file in the home directory but MariaDB will not use it. I even tried recompiling with --exec-prefix as per the MySQL 5.5 documentation but this screws the entire installation up, causing MariaDB to recreate the entire prefix path from root underneath src/efix=/ where I'm storing the source while I install.

Here is my configure options:

./configure --prefix=/home/user/web/servers/mariadb --enable-assembler \
--with-extra-charsets=complex  --enable-thread-safe-client  --with-big-tables \
--with-plugin-maria --with-aria-tmp-tables --without-plugin-innodb_plugin --without-plugin=tokudb \
--with-mysqld-ldflags=-static --with-client-ldflags=-static --with-readline \
--with-ssl --with-plugins=max-no-ndb --with-embedded-server --with-libevent \
--with-mysqld-ldflags=-all-static  --with-client-ldflags=-all-static \
--with-zlib-dir=bundled --enable-local-infile

And here is what happens when I try to launch MariaDB:

$ bin/mysqld_safe --basedir=/home/user/web/servers/mariadb --defaults-file=/home/user/web/servers/mariadb/my.cnf
131128 16:20:20 mysqld_safe Logging to '/home/user/web/servers/mariadb/log/error.log'.
mkdir: cannot create directory ‘/var/run/mysqld’: Permission denied
Fatal error Can't create database directory '/var/run/mysqld/mysqld.sock'

My socket file is specific in the given my.cnf file as /home/user/web/servers/mariadb/run/mysql.sock

No matter what I do I can't get MariaDB to behave and run in user land. What am I doing wrong? I've tried the Linux binaries with slightly more success but I still felt like I was fighting the server to get it to read files from the correct location. I'd like to have it compiled from source though and it *should* be easier this way since I can specify a prefix. How can I get MariaDB to follow the set prefix for all files?

Answer Answered by Elena Stepanova in this comment.

You are using command-line options for mysqld_safe in a wrong order here:

$ bin/mysqld_safe --basedir=/home/user/web/servers/mariadb --defaults-file=/home/user/web/servers/mariadb/my.cnf

defaults-file should be the very first option on the command line (see the documentation). The way you put it now, mysqld_safe simply ignores the defaults file and tries to use the socket location specified in one of the cnf files in default locations. Try to do it this way instead:

$ bin/mysqld_safe --defaults-file=/home/user/web/servers/mariadb/my.cnf --basedir=/home/user/web/servers/mariadb

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.