Posts tagged ‘mysql’

Installing MySQL on SXDE (build 70)

There are a few different ways you could get mysql on your solaris machine:

  • blastwave.org where you can get mysql and many other packages using an apt style package installation mechanism
  • sunsource.net where the packages have been optimised for solaris (and now that Sun are in the process of aquiring mysql we can hope that multitheaded developement will increase in line with Suns processor designs)

For this installation we’ll be using the packages from sunsource.net

So heres what you need to do:

Download the CSKruntime, CSKmysql and the CoolStack Documentation packages from sunsource.net and extract the archives using bzip2.

You should have something like:

# ls
CSKmysql_1.2_x86.pkg        CSKruntime_1.2_x86.pkg

Mysql depends on CSKruntime so install the runtime first:

# pkgadd -d /directory_where_your_file_is/CSKruntime_1.2_sparc.pkg

Once its installed make sure you install mysql having used pkgtrans – otherwise the install won’t work 100% (this has been the case for me, your millage may vary)

# pkgtrans CSKamp_1.2_x86.pkg /var/tmp
# pkgadd -d /var/tmp

Now initialise the database tables:

# /opt/coolstack/mysql/bin/mysql_install_db --datadir=/tank/mysql_data

Note that this is not the usual mysql data directory. In my case, this directory happens to be on a ZFS filesystem in a RAID 1 configuration.

To quote the README that comes with the install in /opt/coolstack/mysql/README

” mysql_install_db creates two directories “mysql” and “test” in data directory.
mysql directory has the MySQL privilege tables. test has the “test” database
These two directories are needed for mysql to start. If you are using a
different data directory later, you need to copy these two directories over. ”

Next create the mysql user and mysql group for the mysql service to use:

# groupadd mysql
# useradd -g mysql mysql
# chown -R mysql:mysql /tank/mysql_data

If you didn’t use the standard mysql data dir you will need to edit the SVC manifest file so that it knows where your data dir is:

/opt/coolstack/lib/svc/method/svc-cskmysql
<snip>
MYSQL_DIR=/opt/coolstack/mysql
DB_DIR=/tank/mysql_data/data/
PIDFILE=${DB_DIR}/`/usr/bin/uname -n`.pid
<snip>

Once this is done you should be able to start the mysql service with a simple:

svcadm enable  csk-mysql

After this you’ll need to log in as root and change the root password to something suitable

#/opt/coolstack/mysql/bin/mysql –user=root mysql

You will also want to add regular users to mysql also