Install MySQL from Source on MIPS

From CobaltFAQs

Jump to: navigation, search

This is a HOWTO for installing the MySQL database server on a Sun Cobalt MIPS-powered server appliance: Qube 2, RaQ 1, or RaQ 2 (it should also work on a Qube 2700 but I don't have one to verify).

DO NOT USE THIS PROCEDURE ON ANYTHING BUT A MIPS-BASED PRODUCT!!! (not for use on RaQ 3, RaQ 4, RaQ XTR, RaQ 550, or Qube 3 -- see Install MySQL from Source for procedures for those machines)

I designed this webpage so that you can just copy/paste each line/block of commands into your shell session and it will "just work" for you, thus avoiding typing.

Some people have reported problems with steps of this procedure if too many lines are cut-and-pasted at once (some directories aren't generated properly, etc). To ensure proper operation, please do the commands one line at a time and wait for each command to complete before executing the next step.

Contents

Install all patches available from Sun

Visit [SunSolve] and download/install all available patches for your RaQ 2. Install them in reverse order (from the bottom of the SunSolve page to the top) -- they are listed in reverse chronological order, and must be installed in sequence. Reboot the server if you had to install any patches, just to make sure everything is properly loaded, etc.

Create a "source" directory

NOTE: All remaining steps should be done as the 'root' user.

Shell into the server as admin using telnet or SSH, then do:

su - root

The "-" is important, to ensure your environment variables (including search path) get set properly. Some commands will not work if you do not do this step correctly!

Then set up a "working" directory to upack and compile the source code in:

mkdir -p /home/src
cd /home/src

Upgrade "broken" compiler and libraries

As the server exists in its default configuration, the compiler and some libraries are "broken" and will not permit you to compile working binaries. Download these files to the server:

export URL=ftp://ftp-eng.cobalt.com/pub/unsupported/raq2/rpms
wget $URL/glibc-profile-2.0.7-29.4C2.mips.rpm
wget $URL/glibc-debug-2.0.7-29.4C2.mips.rpm
wget $URL/glibc-devel-2.0.7-29.4C2.mips.rpm
wget $URL/glibc-2.0.7-29.4C2.mips.rpm

Then install them:

rpm -Uvh --force glibc*.rpm
/sbin/ldconfig

Get these files as well:

export URL=ftp://ftp.linux-mips.org/pub/linux/mips/redhat/5.2/RPMS/mipsel
wget $URL/egcs-1.0.2-9.mipsel.rpm
wget $URL/egcs-c++-1.0.2-9.mipsel.rpm
wget $URL/egcs-g77-1.0.2-9.mipsel.rpm
wget $URL/egcs-objc-1.0.2-9.mipsel.rpm
wget $URL/libstdc++-2.8.0-9.mipsel.rpm
wget $URL/libstdc++-devel-2.8.0-9.mipsel.rpm

and install them:

rpm -e --nodeps gcc-objc
rpm -e --nodeps gcc-c++
rpm -e --nodeps gcc
rpm -e --nodeps libg++-devel
rpm -Uvh egcs*.rpm
rpm -ivh libstdc++*.rpm
/sbin/ldconfig

Get MySQL source code

Visit http://www.mysql.com/ and use an appropriate mirror to get the latest source code version (these directions assume MySQL v3.23.58). Source code tarballs are listed at the very bottom of the "Downloads" page...

NOTE: I have not used MySQL v4.x on the RaQ 2, only 3.23.x... if you choose to try 4.x, I have no experience to help you... you're on your own with it. I do have at least one report that these same directions worked fine with MySQL v4.0.17.

Unpack code

cd /home/src
tar zxvf mysql-3.23.58.tar.gz

This should leave you with the following directory structure:

/home/src/mysql-3.23.58

Build/Install MySQL

/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
cd /home/src/mysql-3.23.58
./configure \
--with-low-memory \
--disable-assembler \
--disable-shared \
--with-mysqld-ldflags="-all-static" \
--with-client-ldflags="-all-static" \
--prefix=/home/mysql \
--localstatedir=/home/mysql/data \
--disable-maintainer-mode \
--with-mysqld-user=mysql \
--without-comment \
--without-debug \
--without-bench \
--without-test \
--without-raid
make
make install

MySQL v4.0.24 instructions

A contributor writes:

  I setup v4.0.24 with these instructions and it works fine. Use these steps instead of the download step immediately above:
  cd /home/src
  wget http://www.klick.us/mips/mysql-4.0.24.mips.tar.gz
  tar xfz mysql-4.0.24.mips.tar.gz
  cd mysql-4.0.24
  make install

Note: on my RaQ 2 with 32MB of RAM, configure takes about 5 minutes, and make takes about an hour to run... This is mentioned to give you some idea of how long to expect each step to take. You won't be able to do anything while either step is running...

Post-install configuration

./scripts/mysql_install_db
chown -R root:mysql /home/mysql
chown -R mysql:mysql /home/mysql/data
echo "/home/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig

Set MySQL to start automatically on server boot

cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
ln -s /etc/rc.d/init.d/mysql /etc/rc.d/rc3.d/S90mysql

Start MySQL and test it

/etc/rc.d/rc3.d/S90mysql start
cd /home/mysql/bin
./mysqladmin version

Set a new 'root' password

./mysqladmin -u root password new-password

Delete the source code

rm -rf /home/src/mysql*
Personal tools