This section lists the operating systems on which MySQL is known to run.
Important: MySQL AB does not necessarily provide official support for all the platforms listed in this section. For information about those platforms which MySQL AB officially supports, see MySQL Server Supported Platforms on the MySQL Web site.
We use GNU Autoconf, so it is possible to port MySQL to all modern systems that have a C++ compiler and a working implementation of POSIX threads. (Thread support is needed for the server. To compile only the client code, the only requirement is a C++ compiler.) We use and develop the software ourselves primarily on Linux (SuSE and Red Hat), FreeBSD, and Sun Solaris (versions 8 and 9).
MySQL has been reported to compile successfully on the following combinations of operating system and thread package. Note that for many operating systems, native thread support works only in the latest versions.
AIX 4.x, 5.x with native threads. See Section 2.13.5.3, “IBM-AIX notes”.
Amiga.
BSDI 2.x with the MIT-pthreads package. See Section 2.13.4.4, “BSD/OS Version 2.x Notes”.
BSDI 3.0, 3.1 and 4.x with native threads. See Section 2.13.4.4, “BSD/OS Version 2.x Notes”.
Digital Unix 4.x with native threads. See Section 2.13.5.5, “Alpha-DEC-UNIX Notes (Tru64)”.
FreeBSD 2.x with the MIT-pthreads package. See Section 2.13.4.1, “FreeBSD Notes”.
FreeBSD 3.x and 4.x with native threads. See Section 2.13.4.1, “FreeBSD Notes”.
FreeBSD 4.x with LinuxThreads. See Section 2.13.4.1, “FreeBSD Notes”.
HP-UX 10.20 with the DCE threads or the MIT-pthreads package. See Section 2.13.5.1, “HP-UX Version 10.20 Notes”.
HP-UX 11.x with the native threads. See Section 2.13.5.2, “HP-UX Version 11.x Notes”.
Linux 2.0+ with LinuxThreads 0.7.1+ or
glibc 2.0.7+ for various CPU
architectures. See Section 2.13.1, “Linux Notes”.
Mac OS X. See Section 2.13.2, “Mac OS X Notes”.
NetBSD 1.3/1.4 Intel and NetBSD 1.3 Alpha (requires GNU make). See Section 2.13.4.2, “NetBSD Notes”.
Novell NetWare 6.0 and 6.5. See Section 2.7, “Installing MySQL on NetWare”.
OpenBSD 2.5 and with native threads. OpenBSD earlier than 2.5 with the MIT-pthreads package. See Section 2.13.4.3, “OpenBSD 2.5 Notes”.
OS/2 Warp 3, FixPack 29 and OS/2 Warp 4, FixPack 4. See Section 2.13.6, “OS/2 Notes”.
SCO OpenServer 5.0.X with a recent port of the FSU Pthreads package. See Section 2.13.5.8, “SCO UNIX and OpenServer 5.0.x Notes”.
SCO Openserver 6.0.x. See Section 2.13.5.9, “SCO OpenServer 6.0.x Notes”.
SCO UnixWare 7.1.x. See Section 2.13.5.10, “SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes”.
SGI Irix 6.x with native threads. See Section 2.13.5.7, “SGI Irix Notes”.
Solaris 2.5 and above with native threads on SPARC and x86. See Section 2.13.3, “Solaris Notes”.
SunOS 4.x with the MIT-pthreads package. See Section 2.13.3, “Solaris Notes”.
Tru64 Unix. See Section 2.13.5.5, “Alpha-DEC-UNIX Notes (Tru64)”.
Windows 9x, Me, NT, 2000, XP, and Windows Server 2003. See Section 2.3, “Installing MySQL on Windows”.
Not all platforms are equally well-suited for running MySQL. How well a certain platform is suited for a high-load mission-critical MySQL server is determined by the following factors:
General stability of the thread library. A platform may have an excellent reputation otherwise, but MySQL is only as stable as the thread library it calls, even if everything else is perfect.
The capability of the kernel and the thread library to take advantage of symmetric multi-processor (SMP) systems. In other words, when a process creates a thread, it should be possible for that thread to run on a CPU different from the original process.
The capability of the kernel and the thread library to run
many threads that acquire and release a mutex over a short
critical region frequently without excessive context
switches. If the implementation of
pthread_mutex_lock() is too anxious to
yield CPU time, this hurts MySQL tremendously. If this issue
is not taken care of, adding extra CPUs actually makes MySQL
slower.
General filesystem stability and performance.
If your tables are large, performance is affected by the ability of the filesystem to deal with large files at all and to deal with them efficiently.
Our level of expertise here at MySQL AB with the platform. If we know a platform well, we enable platform-specific optimizations and fixes at compile time. We can also provide advice on configuring your system optimally for MySQL.
The amount of testing we have done internally for similar configurations.
The number of users that have run MySQL successfully on the platform in similar configurations. If this number is high, the likelihood of encountering platform-specific surprises is much smaller.
Based on the preceding criteria, the best platforms for running
MySQL at this point are x86 with SuSE Linux using a 2.4 or 2.6
kernel, and ReiserFS (or any similar Linux distribution) and
SPARC with Solaris (2.7-9). FreeBSD comes third, but we really
hope it joins the top club once the thread library is improved.
We also hope that at some point we are able to include into the
top category all other platforms on which MySQL currently
compiles and runs, but not quite with the same level of
stability and performance. This requires some effort on our part
in cooperation with the developers of the operating systems and
library components that MySQL depends on. If you are interested
in improving one of those components, are in a position to
influence its development, and need more detailed instructions
on what MySQL needs to run better, send an email message to the
MySQL internals mailing list. See
Section 1.7.1, “MySQL Mailing Lists”.
Please note that the purpose of the preceding comparison is not to say that one operating system is better or worse than another in general. We are talking only about choosing an OS for the specific purpose of running MySQL. With this in mind, the result of this comparison might be different if other factors were considered. In some cases, the reason one OS is better for MySQL than another might simply be that we have been able to put more effort into testing and optimizing for a particular platform. We are just stating our observations to help you decide which platform to use for running MySQL.

User Comments
The information above on FreeBSD (covering versions up through 4.X) is now outdated. A lot of work has gone into improved threading libraries with FreeBSD versions 5.X in conjunction with the SMPng project. For older versions of FreeBSD, you can also use the linuxthreads options.
See `man pthread` and `man libkse` within FreeBSD 5.X for more details on libkse, libthr and the improved threading model.
To quote from the 5.X release notes:
"The libkse library, providing POSIX threading support using KSE, is now enabled and installed by default. This library currently supports M:N threading. Both process and system scope threads are supported, as well as getting/setting the concurrency level. By default, the library sets the concurrency level to the number of CPUs in the system. Each concurrency level correlates to a KSE, and all process scope threads run in these KSEs. Each system scope thread gets its own KSE in addition to those corresponding to concurrency levels. libkse is still considered a work-in-progress, and is not used by default. However, it can be used as a replacement for the libc_r thread library, by substituting -lkse instead of -pthread when linking programs.
MySQL is now being used with success with the FreeBSD 5.X threading models on multiple websites, so you shouldn't let this manual section discourage you from installing and using MySQL on your own FreeBSD 5.X server. Real-life experience with 5.X demonstrates that while there may still be a few minor issues, the situation is much improved and much closer to the previous support for MySQL's desired threading model on Linux.
Compile MySQL 4.1.x in FreeBSD 5.2+ with KSE threads:
./configure --prefix=/usr/local/mysql --without-libedit --without-readline --without-debug --without-bench --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-extra-charsets=complex --with-named-thread-libs='-lkse -D_THREAD_SAFE' CFLAGS='-pipe -march=i686 -fno-omit-frame-pointer -O2 -D_THREAD_SAFE' CXXFLAGS='-pipe -march=i686 -fno-omit-frame-pointer -O2 -felide-constructors -fno-rtti -fno-exceptions -D_THREAD_SAFE'
You must tune somethings abount sysctl
kern.threads.max_threads_per_proc
kern.threads.max_groups_per_proc
Default is 150 50 ,and it's too low
Try to change them to 1000.
Also you can build the mysql with pthread, dynamic execuable.
Then add the libc_r to libkse at /etc/libmap.conf
If you are using FreeBSD 5.3+, use -lpthread instead of -lkse
Add your own comment.