Building MySQL on OpenSolaris (from a source distribution)
By Jennifer Glore on Nov 10, 2008
One of the things that I've been wanting to do is build MySQL. I checked out this blog from Neel and the instructions posted on the MySQL site and it looked fairly straightforward. After going through the steps, I can say that it proved to be quite simple. Note that I built the latest rc candidate of MySQL on OpenSolaris using Sun's compilers. Here are the steps for people who are interested.
- Install OpenSolaris. I already have OpenSolaris 2008.05 running within VirtualBox on my laptop. If you need the ISO image, it can be downloaded from here.
- Install Sun compilers by issuing the following command: pfexec pkg install ss-dev. The tools are installed in /opt/SunStudioExpress.
- Prepare the user environment for MySQL by issuing the following commands:
- groupadd mysql
- useradd -g mysql mysql
- gunzip mysql-5.1.29-rc.tar.gz
- tar xvf mysql-5.1.29-rc.tar
- export CC=/opt/SunStudioExpress/bin/cc
- export CXX=/opt/SunStudioExpress/bin/CC
- export CFLAGS="-xO3" #Change this to have your compiler variables
- export CXXFLAGS="-xO3"
- export PATH=$CC:$CXX:/usr/sfw/bin:/usr/ccs/bin:$PATH
- The configure command allows you to control the configuration of the MySQL source distribution. A full listing of the options to configure can be found here. Prefix simply installs architecture-independent files in the location specified by prefix (everything is installed under
/usr/local/mysqlrather than the default of
At this point, under /usr/local/mysql/bin, you will see the mysql_install_db script, which will allow you to install MySQL. After that, you can run mysqld_safe to start mysql.