Since you said you were new to OpenBSD, I trust the length of this
post is justified, and I'm not offending others on this list.
I've been using OpenBSD around 5 years now, but I had not subscribed
or ever posted anything to @misc until your post.  Actually, I've
never participated in any mailing list until now, so I hope my
humble attempt is helpful in some small way.  Please understand that
I trust the documentation over which the developers have spent
countless hours to make clear and precise, so I will only offer
what much wiser and knowledgeable persons (the OpenBSD developers)
have written.  Speaking again only for myself, I have learned that
in order to understand what the OpenBSD developers have so clearly
and precisely written, I must read it multiple times before I grasp
the concept well enough to achieve my objectives.  In other words,
pay very close attention to everything in the OpenBSD documentation.
Also read references to man pages if mentioned for additional insight.

I'm running -current with mysql-server-5.1.71v0 on amd64, and I am
including the README for mysql-server on MY box below.  The README
file on YOUR box may be different.  Please pay very careful attention
to the section entitled "chrooted daemons and MySQL socket" and note
that there are two things to do in order to place the MySQL socket in
the chroot:

1) Create a directory for the MySQL socket, and
2) Adjust /etc/my.cnf to put and connect to the MySQL socket within
the chroot.

See below for full context and note the author :)


$OpenBSD: README-server,v 1.7 2013/03/17 07:22:23 ajacoutot Exp $

+-----------------------------------------------------------------------
| Running mysql-server-5.1.71v0 on OpenBSD
+-----------------------------------------------------------------------

Initial setup
=============

If you are installing MySQL for the first time, you have to create
a default database first. In order to create the database, please run
/usr/local/bin/mysql_install_db

You will need to tune the values in the my.cnf file (examples
available in /usr/local/share/mysql).

By default, the _mysql user, and so the MySQL processes run in the
login(1) class of "daemon". On a busy server, it may be advisable
to put the _mysql user and processes in their own login(1) class
with tuned resources, such as more open file descriptors etc.

For example, add this to the login.conf(5) file:

        mysqld:\
                :openfiles-cur=1024:\
                :openfiles-max=2048:\
                :tc=daemon:

Rebuild the login.conf.db file if necessary:

        # [ -f /etc/login.conf.db ] && cap_mkdb /etc/login.conf

For larger servers and dedicated database servers, these numbers
and memory limits (e.g. datasize and stacksize) may also need to be
increased. Please report any changes and experiences to the package
maintainers so that we can update this file for future versions.

chrooted daemons and MySQL socket
=================================

For external program running under a chroot(8) to be able to access the
MySQL server without using a network connection, the socket must be
placed inside the chroot.

e.g. httpd(8) or nginx(8): connecting to MySQL from PHP
-------------------------------------------------------
Create a directory for the MySQL socket:

    # install -d -m 0711 -o _mysql -g _mysql /var/www/var/run/mysql

Adjust /etc/my.cnf to put and connect to the MySQL socket
within the chroot:

    [client]
    socket = /var/www/var/run/mysql/mysql.sock

    [mysqld]
    socket = /var/www/var/run/mysql/mysql.sock

I follow the directions above whenever I set up a new box, and I
check that mysql-server is running in the chroot after I reboot the
box.  Output from my box is below:

$ /usr/bin/sudo ls -l /var/www/var/run/mysql/
total 0
srwxrwxrwx  1 _mysql  _mysql  0 Aug 23 22:10 mysql.sock

Then I load up mysql-server.  Now that I've done this a few
thousand times, it's easy . . .

Gilbert

On Fri, Aug 23, 2013 at 10:06 PM, Guy Ferguson <guyfergu...@tpg.com.au> wrote:
> Hmm - ok, I actually just went to that path
> (/usr/local/share/doc/pkg-readmes/) and there are 4 files, one of which is a
> mysql-server-5.x.xx......but it's only 1325  bytes, and certainly no
> comments from users like ajacoutot@. I mean, there are maybe two or three
> sugegstions about changing the login.conf and my.cnf, but it certainly
> wouldn't have been any help with the issues i faced.
>
> Perhaps there are some other dox in another location?
>
> thanks,
>
> Guy
>
> On 23/08/2013 22:16, Gilbert Sanford wrote:
>>
>> The instructions in /usr/local/share/doc/pkg-readmes/mysql-server-5.1.xx
>> have always worked for me . . . very handy reference with specific
>> instructions from ajacoutot@ on "Running mysql-server-5.1.xx on
>> OpenBSD."
>>
>> Gilbert

Reply via email to