How to install MySQL database server in Sun Solaris

Installation of MySQL Database server on Solaris is not that difficult but is a bit dragging and not as straightforward as is in any other Linux flavors. The following procedure will help install MySQL and configure successfuly in Sun Solaris.

To install MySQL Database server on Solaris follow the procedures listed below:

Note: I've used MySQL-5.0.24a for Solaris 8. However, this is a very generic
procedure and I'm sure will work on other Solaris versions. 

Download the MySQL Package for solaris from

http://dev.mysql.com/downloads/mysql/5.0.html

Once downloaded unzip using

# gzip mysql-standard-5.0.24a-solaris8-sparc-64bit.tar.gz

Now, comes the first problem, you need to have GNU Tar installed on your Solaris server as there is bug in getting the classic Solaris one to work.

To download and install GNUTar, please click here

Untar using GNUTar by

# tar -xvf mysql-standard-5.0.24a-solaris8-sparc-64bit.tar

Now, install using

# pkgadd -d mysql-standard-5.0.24a-solaris8-sparc-64bit.pkg

This installs the software. You can be confirmed using

# pkginfo -l mysql

pkginfo output for mysql installation in Sun Solaris

This will give a detailed output describing the installation.

Now, change dir to /opt/mysql/mysql/support-files

# cd /opt/mysql/mysql/support-files

Copy the my-middle.cnf as my.cnf and mysql.server to /opt/mysql/mysql/scripts

# cp my-middle.cnf ../scripts/my.cnf
# cp mysql.server ../scripts/

Now, change to /opt/mysql/mysql/scripts folder

# cd opt/mysql/mysql/scripts

Edit file my.cnf using vi

#vi my.cnf

Add the following lines to the file under [mysqld]


datadir=/opt/mysql/mysql/data
basedir=/opt/mysql/mysql
log
log-update

Similary, edit the mysql.server file and add the following lines:

# vi mysql.server

basedir=/opt/mysql/mysql
datadir=/opt/opt/mysql/mysql/data
conffile=/opt/mysql/mysql/scripts/my.cnf
mysql_daemon_user=mysql

Now, all done, run the mysql_install_db script as follows

# ./mysql_install_db –defaults-file=/opt/mysql/mysql/scripts/my.cnf

This creates the initial MySQL database.

Now, start MySQL using

cd . ; /opt/mysql/mysql/bin/mysqld_safe &

This will start MySQL.

Now, you need to set the password for root account

# /opt/mysql/mysql/bin/mysqladmin -u root password ‘newpassword’
# /opt/mysql/mysql/bin/mysqladmin -u root -h <hostname> password ‘newpassword’

This completes a successful installation of MySQL on your Solaris Server. 

1 thought on “How to install MySQL database server in Sun Solaris”

  1. # vi mysql.server

    basedir=/opt/mysql/mysql
    datadir=/opt/opt/mysql/mysql/data
    conffile=/opt/mysql/mysql/scripts/my.cnf
    mysql_daemon_user=mysql
    is that suppose to be
    datadir=/opt/mysql/mysql/data
    I cant get it to create the database for mysql I just might tar and take the one out of my linux system

Leave a Comment

Your email address will not be published. Required fields are marked *