Sunday, August 25, 2024

Re: MariaDB install any different for OpenBSD 7.5 than 6.4?

On Sun, Aug 25, 2024 at 02:49:03PM -0400, David Colburn wrote:
> > After a cursory reading, it looks OK. But don't forget to read the
> > supplied documentation, after installing the package:
> >
> > less /usr/local/share/doc/pkg-readmes/mariadb-server
> >
> > Also, most of those steps don't have to do with mariadb, but with simple
> > system administration. Installing the package, starting and stopping
> > services, and checking if processes are running and ports are open are
> > all tasks you should be familiar with.
>
> All good to this point, thanks.
>
> Now I'm reading this in
>
> /usr/local/share/doc/pkg-readmes/mariadb-server
>
> Given that lighttpd runs in chroot am I correct that I need to run the
> following
>
> install and then edit /etc/my.cnf for things to play nicely together?
>
> Thanks,
>
> David
>
> --------------------------------------------------------------------------------------------------------------------
>
> chrooted daemons and MariaDB socket
> ===================================
>
> For external program running under a chroot(8) to be able to access the
> MariaDB server without using a network connection, the socket must be
> placed inside the chroot.
>
> e.g. httpd(8) or nginx(8): connecting to MariaDB from PHP
> ---------------------------------------------------------
> Create a directory for the MariaDB socket:
>
>     # install -d -m 0711 -o _mysql -g _mysql /var/www/var/run/mysql
>
> Adjust /etc/my.cnf to use the socket in the chroot - this
> applies to both client and server processes:
>
>     [client-server]
>     socket = /var/www/var/run/mysql/mysql.sock

You have three progressively less restrictive ways of providing access
to your database server:

* A Unix socket:
If all the database consumers will be running locally, you can use a
socket. If any of the consumers will be running chrooted to /var/www,
then you'll need to put the socket in the chroot, as described on the
pkg-readme (and remember not to use the full path when configuring the
chrooted clients).

* TCP, listening on 127.0.0.1:
If all consumers will be running on the same host, and if you don't want
the hassle of setting up the socket -- the tradeoff being having the
socket available for every process that can use inet -- then you can
just configure mariadb to listen on the loopback interface. If you have
"set skip on lo0" on pf.conf (it's there by default), then you won't
need to add anything else to that file.

* TCP, listening on other interfaces:
You'll need this if the database is to be accessible to other hosts.
Using this option might require adjusting your filtering rules on
pf.conf.


You can use any combination of the above methods (socket only, loopback
only, socket+loopback, socket+other interfaces, etc). See the "port",
"socket", "skip-networking" and "bind-address" options on the [mysqld]
section of /etc/my.cnf, and remember to setup the [client] section
accordingly (i.e., if you skip-networking, don't configure the client to
use TCP/IP, and if you don't setup a server socket, don't configure the
client to use it).

And make sure you know what you need, and why, before configuring
things.

--

No comments:

Post a Comment