Freebsd – Completely stuck on a new mariadb-server initialization

freebsdmariadb

New install of mariadb-server 5.5.38 on FreeBSD 10.0-RELEASE-p5 amd64 refuses to start.

Currently refusing to start for this reason:

140808 14:12:28 [ERROR] mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
140808 14:12:28 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
140808 14:12:28 [Note] Server socket created on IP: '::'.
140808 14:12:28 [ERROR] mysqld: Can't find file: './mysql/host.frm' (errno: 13)
140808 14:12:28 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
140808 14:12:28 mysqld_safe mysqld from pid file /var/db/mysql/milicent.ericx.net.pid ended

And, of course, the referenced mysql_upgrade refuses to run because the server is not running (so I'm ignoring the plugin.frm error for the time being).

Everything I can find suggests that host.frm should be created first-start in the datadir. Obviously mysqld understands that datadir=./mysql. This in spite of the fact that /usr/local/etc/my.cnf specifies datadir:

[mysqld]
    datadir=/var/db/mysql

AND I'm specifying datadir=/var/db/mysql on the command line as well.

/var/db/mysql is owned by mysql:mysql and has permissions 750 as confirmed by the fact that mysqld has happily created the subdirectories mysql and test.

How else might the path to host.frm be specified?

Can I make the file by hand? (i.e. is it a text file?)

Running mysql_install_db --user mysql --datadir /var/db/mysql fails with the same error.

–update:
I've even tried starting the server from the /var/db directory to obviate the relative path ./mysql; but that still fails. So the relative path starting point is something other than the directory where the program is run.

Best Answer

Everything I can find suggests that host.frm should be created first-start in the datadir.

Whatever suggested that to you is flat out wrong. The system tables are created when you run mysql_install_db.

MariaDB official docs: Installing system tables (mysql_install_db).