MariaDB is a drop-in replacement for MySQL forked from MySQL by some of the original developers of MySQL after Oracle acquired Sun (and thus acquired MySQL).
To use MariaDB instead of (the default) MySQL, set in /etc/make.conf
DEFAULT_VERSIONS+=mysql=102m
Contents
MariaDB server installation
There are many versions of MariaDB available in the repos. Use this command to list all available versions.
pkg search mariadb | grep server
Install the version you wish (typically the latest version, replace the XXX in the command below with the desired version number listed above).
- Installing the server will automatically installs the client as a dependency.
sudo pkg install mariadbXXX-server
Set MariaDB to start at boot
sudo sysrc mysql_enable=YES
Start MariaDB
sudo service mysql-server start
Run this interactive script to perform basic security hardening of the installation.
When asked, it's recommended to not provide a root database user password. (Accessing the server console as the root database user is done simply with sudo mysql.)
/usr/local/bin/mysql_secure_installation
Verify that MariaDB is only accessible via localhost
$ sockstat -4 -6 | grep 3306 mysql mariadbd 989 33 tcp4 127.0.0.1:3306 *:*
If the output lists 127.0.0.1:3306, then your server is not listening to remote connections. If *:3306 is listed, then remote connections are enabled.
Troubleshooting
Connections to localhost fail
Try connecting via the UNIX socket as specified in /usr/local/mysql/my.cnf, like this:
localhost:/var/run/mysql/mysql.sock
History
2010-11-17 databases/mariadb MariaDB 5.2 added by Geoffroy Desvernay (NOTE: MariaDB 5.2 has been removed from the ports tree).
2011-06-06 databases/mariadb-server MariaDB 5.2.5 split into a -server and -client ports
- 2012-04-20 databases/mariadb updated to 5.3 (NOTE: MariaDB 5.3 has been removed from the ports tree 2015-11-18).
2013-01-05 databases/mariadb55-server MariaDB 5.5 added by Alexandr Kovalenko.
2014-11-04 databases/mariadb100-server MariaDB 10.0 and all subsequent added by Bernard Spil
2016-02-13 databases/mariadb101-server
2017-01-15 databases/mariadb-connector-c MariaDB C Connector 2.3 later updated to 3.0
2017-05-28 databases/mariadb102-server MariaDB 10.2
2018-02-13 databases/mariadb-connector-odbc MariaDB ODBC Connector 3.0
2018-06-09 databases/mariadb103-server MariaDB 10.3
Upcoming
MariaDB releases are generally supported for 5 years after the first General Availabiity release
- 2019 Expected release of MariaDB 10.4
- 2019-03-31 Expected End-of-Life MariaDB 10.0
- 2020-04-11 Expected End-of-Life MariaDB 5.5
- 2020-10-17 Expected End-of-Life MariaDB 10.1
- 2022-05-23 Expected End-of-Life MariaDB 10.2
- 2023-05-25 Expected End-of-Life MariaDB 10.3
MariaDB 5.2 - 10.2
The MariaDB port was initially created by Geoffroy Desvernay. The MariaDB 5.5 port was created by Alexandr Kovalenko and the basis for the later 10.x versions created by Bernard Spil (brnrd). The port consists of a master- (-server) and slave-port (-client) as of version 5.3
Extensive patching of the cmake files was done to work around conflicts between the -client and -server ports.
MariaDB 10.3 -
This version removes the cmake patching and replaces it with @comment prefixes in pkg-plist. The only CMakeFiles.txt patching that's going on must have an accompanying issue in MariaDB JIRA.
Porting
The WITHOUT_SERVER flag for cmake isn't very stable, files move in and out. This results in install conflicts when the port is updated.
Generate clean pkg-plist
Disable post-install targets for both -client and -server, it deletes parts of the install tree.
- Build the port.
run make makeplist and store the output.
compare makeplist output for -client and -server and add @comment in pkg-plist where changes are required (bear in mind the post-install target).
ls -l $(sed -n 's|^@comment |work/stage/usr/local/|p' pkg-plist) >/dev/nullUpdate and enable post-install target.
I've found the Debian packages to be helpful in deciding what's client and what's server.
Check duplicate @comment lines
for file in `sed -n 's|^@comment ||p' pkg-plist` ; do grep "^@comment $file" ../mariadb103-client/pkg-plist ; done
or
# files marked @comment show up with a number higher than 1 grep '^@comment ' mariadb103-*/pkg-plist | cut -d: -f2 | sort | uniq -c
Things not needed on FreeBSD
file/dir |
reason |
mariadb-service-convert |
generates mariadb.service for systemd |
share/mysql/policy |
SELinux and AppArmor files |
Upstream issues
MDEV-11790
WITHOUT_SERVER installs server-only files Tries to address inconsistencies in the cmake files. This is a patch in the ports tree for 10.3.
MDEV-15961
Fix stacktraces under FreeBSD Fixing aarch64 builds