Saturday, 26 February 2011

Installing MySQL on Solaris (Part 1 - Installing the files)

To install MySQL on Solaris, you first need to download it from the MySQL Community Server website.

Before installing MySql, the first job is to create the mysql group by typing: 

groupadd mysql

Next, create the mysql user by typing: 

useradd -g mysql mysql

Change to the directory where the MySQL packages were downloaded to:

cd /my-downloads

Install the package by typing: 

pkgadd -d mysql-xxx.pkg

Just accept the default install directory (/opt/mysql) when prompted and go through the installation process.

The MySQL should have been installed in

/opt/mysql/mysql

After the installation, change the path to "/opt" and type this:
chown -R mysql:mysql mysql

This is to change the ownership of the whole mysql install directory. The big idea is to ensure that the UNIX permissions match the mysql user permissions. For example, if you create your mysql data directory (by running 

scripts/mysql_install_db --user=mysql --ldata=/export/home/mysql_data)

…then you need to ensure that all the permissions match up. A good way of doing this is to do a 

chown –R mysql:mysql /export/home/mysql_data


An Installation Bug
You may wish to install mysql to a non-default location; perhaps you're short of disk space or something on your default disk. You may do something like:



cd /export/home
mkdir opt
chgrp sys opt

and then add the ‘mysql’ package:

pkgadd –R /export/home –d mysql-5.1.51-solaris10-sparc.pkg

but it fails – pkgadd calls a script in the installation files and this script contains lots of hardcoded path names, which cause an install failure. So always stick to the default location and just type:

pkgadd –d mysql-5.1.51-solaris10-sparc.pkg





No comments: