FreeBSD 4.x is recommended for running MySQL since the thread package is much more integrated.
The easiest and therefore the preferred way to install is to use the mysql-server and mysql-client ports available on http://www.freebsd.org/.
Using these gives you:
It is recommended you use MIT-pthreads on FreeBSD 2.x and native threads on
Versions 3 and up. It is possible to run with native threads on some late
2.2.x versions but you may encounter problems shutting down mysqld
.
Unfortunately, certain function calls on FreeBSD are not yet fully
thread-safe, most notably the gethostbyname()
function, which is
used by MySQL to convert host names into IP addresses. Under certain
circumstances, the mysqld
process will suddenly cause 100%
CPU load and will be unresponsive. If you encounter this, try to start
up MySQL using the --skip-name-resolve
option.
Alternatively, you can link MySQL on FreeBSD 4.x against the LinuxThreads library, which avoids a few of the problems that the native FreeBSD thread implementation has. For a very good comparison of LinuxThreads vs. native threads have a look at Jeremy Zawodny's article "FreeBSD or Linux for your MySQL Server?" at http://jeremy.zawodny.com/blog/archives/000203.html.
The MySQL `Makefile's require GNU make (gmake
) to work. If
you want to compile MySQL you need to install GNU make
first.
Be sure to have your name resolver setup correct. Otherwise, you may
experience resolver delays or failures when connecting to mysqld
.
Make sure that the localhost
entry in the `/etc/hosts' file is
correct (otherwise, you will have problems connecting to the database). The
`/etc/hosts' file should start with a line:
127.0.0.1 localhost localhost.your.domain
The recommended way to compile and install MySQL on FreeBSD with gcc (2.95.2 and up) is:
CC=gcc CFLAGS="-O2 -fno-strength-reduce" \ CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions -felide-constructors \ -fno-strength-reduce" \ ./configure --prefix=/usr/local/mysql --enable-assembler gmake gmake install ./scripts/mysql_install_db cd /usr/local/mysql ./bin/mysqld_safe &
If you notice that configure
will use MIT-pthreads, you should read
the MIT-pthreads notes. See section 2.3.6 MIT-pthreads Notes.
If you get an error from make install
that it can't find
`/usr/include/pthreads', configure
didn't detect that you need
MIT-pthreads. This is fixed by executing these commands:
shell> rm config.cache shell> ./configure --with-mit-threads
FreeBSD is also known to have a very low default file handle limit.
See section A.2.17 File Not Found. Uncomment the ulimit -n
section in
mysqld_safe
or raise the limits for the mysqld
user in /etc/login.conf
(and rebuild it with cap_mkdb /etc/login.conf). Also be sure you set the
appropriate class for this user in the password file if you are not
using the default (use: chpass mysqld-user-name). See section 4.7.2 mysqld_safe
, The Wrapper Around mysqld
.
If you have a lot of memory you should consider rebuilding
the kernel to allow MySQL to take more than 512M of RAM.
Take a look at option MAXDSIZ
in the LINT config
file for more info.
If you get problems with the current date in MySQL, setting the
TZ
variable will probably help. See section F Environment Variables.
To get a secure and stable system you should only use FreeBSD kernels
that are marked -RELEASE
.
Posted by Konstantin Smirnov on Tuesday January 29 2002, @8:30am | [Delete] [Edit] |
If you're going to use MySQL on FreeBSD at 2 or
more CPU's machine, please note, that MySQL would
use only one CPU.
It's because of FreeBSD cannot optimize threads
between multiple CPUs (this feature should appear
in 5.0).
If you want to get full efficiency of
such system, you should compile MySQL with
LinuxThreads, and all optimization, recomended
below. NB: you SHOULD use FreeBSD 4.4 or later,
since older versions work bugly with
LinuxThreads.
Posted by FreeBSD Forums on Saturday March 9 2002, @2:26am | [Delete] [Edit] |
On high volume servers using MySQL with FreeBSD
it is also recommended increasing MAXUSERS (i.e.
basically recompiling/rebuilding your kernel). <a
href="http://www.freebsdforums.org/forums">FreeBSD
Forums</a>
Posted by FreeBSD Forums on Sunday May 26 2002, @1:33am | [Delete] [Edit] |
For a guide to securing MySQL on FreeBSD, check
out <a
href="http://www.freebsdforums.org/forums/showthre
ad.php?threadid=835">this</a> informative article!
Posted by [name withheld] on Friday January 17 2003, @5:00pm | [Delete] [Edit] |
jeremy zawodny's got a heap of interesting info relative to running mysql on freebsd (4.x). check it out here: http://jeremy.zawodny.com/blog/archives/000203.html
Posted by shilling on Sunday March 23 2003, @11:33pm | [Delete] [Edit] |
When the DB server encounters many query,
I got these error messages when I upgrade from
MySQL 3.23 to MySQL 4.0.12 on a FreeBSD 4.8-PRERELEASE
I query the database via JDBC with the 3.0.6-stable Java API
It seems that there is no problem when using C API
=== cut ===
ERROR 1030: Got error 12 from table handler
ERROR 1135: Can't create a new thread (errno 35). If you are not out of available memory, you can consult the manual for a possible OS-dependent bug
=== cut ===