OpenBSD Journal

MySQL on OpenBSD

Contributed by jose on from the help! dept.

Dan Mayer writes:
"I haven't been able to get mysql running on my openBSD box for a couple months. I have Apache, PHP, and Tomcat all running fine, but for some reason i run into many road blocks. I got it finally installed but it wouldn't run properly and i decided the tricks i did to get it installed probably broke it."

"So i wanted to start with a clean slate and ask the OpenBSD community for help. So i am going to start with the very first problem and hope the group can work through everything with me. I am using the ports tree and I went to usr/ports/databases/mysql and ran make clean and then make. I get this error:
===>  mysql-client-3.23.42 depends on: pthread.14 - pthread.14 missing...
===>  Verifying install for pthread.14 in devel/pth
===> Returning to build of mysql-client-3.23.42
===>  mysql-client-3.23.42 depends on: pthread.14 - pthread.14 missing... pthread.14 missing...
Any ideas, suggestions, or help? If anyone could take a couple hours to work with me over the net to get this set up i would be forever greatful."
Anyone care to offer up some help in debugging ports and packages problems? Please, something beyond the "STFA" type of response ...

(Comments are closed)

  1. By Ian McWilliam () on

    The 3.1-stable port && current port does not rely on building pthread library.

    What release are you trying this on?

    ===> Checking files for mysql-client-3.23.49
    `/usr/ports/distfiles/mysql-3.23.49.tar.gz' is up to date.
    >> Checksum OK for mysql-3.23.49.tar.gz. (sha1)
    ===> Extracting for mysql-client-3.23.49
    ===> Patching for mysql-client-3.23.49
    ===> Configuring for mysql-client-3.23.49
    creating cache ./config.cache
    checking host system type... i386-unknown-openbsd3.1
    checking target system type... i386-unknown-openbsd3.1
    checking build system type...


    A package seems to build fine.

    ===> Building package for mysql-server-3.23.49
    Creating package /usr/ports/packages/i386/All/mysql-server-3.23.49.tgz
    Using SrcDir value of /usr/ports/databases/mysql/w-mysql-3.23.49/fake-i386/usr/local
    Creating gzip'd tar ball in '/usr/ports/packages/i386/All/mysql-server-3.23.49.tgz'
    ===> Building package for mysql-tests-3.23.49
    Creating package /usr/ports/packages/i386/All/mysql-tests-3.23.49.tgz
    Using SrcDir value of /usr/ports/databases/mysql/w-mysql-3.23.49/fake-i386/usr/local
    Creating gzip'd tar ball in '/usr/ports/packages/i386/All/mysql-tests-3.23.49.tgz'

  2. By Jim () on

    As a database purist, I recommend running Postgresql. MySQL does not qualify as a database. It just a fancy bit pile.

    I really shouldn't start db wars though. I just like to advocate for a real database.

  3. By Ben Goren () on

    I've never had one lick of trouble with MySQL on OpenBSD. I've been using it since OpenBSD 2.8 at least. Just a week or two ago, I put it on a -STABLE system built the day before.

    Is there any particular reason you're not trying to install the package? I think earlier I installed it from the ports tree, but that was before I knew better.

    I definitely agree with Mr. McWilliam: what version OpenBSD? What version ports tree? How have they been updated? Are you running anything that didn't come from the ports tree...?

    In short, there's something very peculiar about your problem. Personally, I'd try to install the package on a freshly installed system and start from there....

    Good luck,


  4. By Dan Mayer () on

    I got the thing to install. I was using the ports tree, because i just didn't know better i guess. So i used the package and that seemed to install. I now am faced with this error, which i believe i have gotten to before. Any ideas?
    WARNING: The host 'bandddesigns' could not be looked up with resolveip.
    This probably means that your libc libraries are not 100 % compatible
    with this binary MySQL version. The MySQL deamon, mysqld, should work
    normally with the exception that host name resolving will not work.
    This means that you should use IP addresses instead of hostnames
    when specifying MySQL privileges !
    Preparing db table
    Preparing host table
    Preparing user table
    Preparing func table
    Preparing tables_priv table
    Preparing columns_priv table
    Installing all prepared tables
    /usr/libexec/ mysqld: No such file or directory
    Installation of grant tables failed!

    Examine the logs in /var/mysql for more information.

    Thanks for the help so far, i am fairly new to openBSD and it is just a hobby for me so i am afraid I am not all that good with it yet.

  5. By W () on

    I installed it from source and neither I or my users (as far as I know) are having any problems.

    ./configure --prefix=/usr/local/mysql
    make install

    And don't forget ldconfig.

  6. By Warthog () on

    I've been donating shell accounts to the MySQL AB guys to get to the bottom of why MySQL and OpenBSD don't get along together. They've been running into some platform specific problems they haven't seen anywhere else. Here are some of the comments I've gotten from the MySQL developers, and maybe they will make sense to someone here.


    We have now compiled MySQL 4.0.3 on it and it 'almost works'.

    When running 'make test' this dies when we test the encode/decode
    functions in MySQL.

    This function is in sql/ and looks as follows:

    void SQL_CRYPT::decode(char *str,uint length)
    for (uint i=0; i {
    shift^=(uint) (rnd(&rand)*255.0);
    uint idx= (uint) ((unsigned char) str[0] ^ shift);
    *str = decode_buff[idx];
    shift^= (uint) (uchar) *str++;

    I debugged this for some hours by putting printf() statements in the
    code and concluded the following:

    Sometimes, when length is about 100000, the expression '(uint)
    (rnd(&rand)*255.0)' generates 'a not expected value'. When this
    happens, the next generated value is again what is expected.

    This should never happen as the rnd() function is initialized to a
    known value in advance and should always generate the same random
    number sequence.

    The only explanations I can come up with this are:

    - Gcc doesn't generate thread safe floating point code in this case.
    - There is a bug in how floating point registers are stored/handled by the
    operating system during a thread switch.

    I have the assembler output from the decode() function you would like
    to take a look at this.

  7. By Aaron () on


    It sounds like you have installed MySQL from the pre-built OpenBSD package. That's great, and here is the one step that gets way too many people: you also need to install the pth-*.tgz package as well and make sure to setup shlibs in /etc/rc.conf to include the mysql libraries and the pthread libraries.
    If you install the mysql package using pkg_add -v it will mention the pth package as well as the ldconfig additions required.

    If you decide to install mysql using the ports system it will build and install pthreads as required without intervention. I have not installed mysql myself that way, but I would think that you will still need to get ldconfig to add the proper libs.

    Good luck in your efforts.

  8. By Dan Mayer () on

    I would like to thank everyone for their help. Using your suggestions and some more i found elsewhere i finally after huge amounts of effort have a working and running MySQL. I have created databases tables and run queries all successfully. I would once again just really like to thank you all for you time and effort.
    Dan Mayer


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]