« Rackspace vs. ServerBeach | Main | mysql_config not Displaying Options Correctly »

February 19, 2004

Build MySQL (4.0.18) from Source

The release of MySQL 4.0.18 gave me reason to revisit my recent packaging of MySQL (yea, it's only been a few days since I built it). There were two things bothering me about the package.

  1. I failed to speciy a user_id for the mysql user account created in the package, meaning it would assign the next default number and I'd rather have a specific id assigned on each machine. Easy to fix in the preinstall script.
  2. I used the precompiled binary of MySQL for Solaris, not a bad thing but I at least wanted to look into what I might gain from compiling it myself. I have compiled in the past, but I guess MySQL folks got to me with this line:
    For maximum stability and performance, we recommend that you use the binaries we provide.
As expected, the MySQL docs has good information about configure options and how compiling and linking affects performance. Documentation also contains a listing of compile options used when creating the prebuilt binaries.

It appears that I can add a few things to the compiler flags used to make the prebuilt binary to further optimize MySQL (specifically for UltraSPARC machines).

The compiler args and configure options I settled on after reading through the docs:

CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mcpu=v8 -Wa,-xarch=v8plusa" ./configure --prefix=/usr/local/mysql-4.018 --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-curses-libs=-lcurses --disable-shared --with-mysqld-user=mysql --without-isam --with-named-z-libs=no
. . . waiting for make and make test to finish.

Posted by mike at February 19, 2004 2:59 PM