Installing and Configuring MySQL on Solaris

This is the first part of the 3 part series, installing WordPress on Solaris 10 on x86. Here is a brief idea for what we are going to cover.

  1. Installing and configuring MySQL [this article]
  2. Installing and configuring Apache web server with PHP [part-2]
  3. Configuring wordpress on Solaris [final part]

MySQL come pre-installed on Solaris 10. However, The MySQL that came out with Solaris 10, is an older version (v4.x) and is not compatible with new installations of most other CMSs today (including wordpress). Hence we will use sunfreeware as a source to fetch all required packages and install and configure them to work together.

One major advantage is, all the packages downloaded from sunfreeware have a SMC prefix to it, so that they do not conflict with existing Solaris packages. Also, they install on /usr/local directory, as instead of /usr/sfw or /usr/bin to avoid further complications.

Installing MySQL

For the installation, download the MySQL package along with these additional packages from sunfreeware.

  • mysql-5.0.67
  • libgcc-3.4.6
  • openssl-1.0.1
  • ncurses-5.7
  • libiconv-1.14
  • libintl-3.4.0

This exact version number may not always be available, as they continue to change, once updated packages are available. You may consider looking for a compatible version, usually mentioned below the download link of a package on sunfreeware web site.

Unpack the downloaded files and use pkgadd command to install the packages as root user.

Configuring MySQL

To configure MySQL, we have to do several steps as root user. As root user, create the following directories and change permissions:

# groupadd mysql
# useradd -g mysql mysql
# cd /usr/local
# chown -R mysql:mysql mysql
# chmod -R 770 /var/mysql

Now, we will initialize the MySQL database.

# cd /usr/local/mysql
# scripts/mysql_install_db --user=mysql

Now, test the installation with the following command

# cd /usr/local/mysql/mysql-test
# su mysql -c ./mysql-test-run.pl

We are not going to test all functionalities of MySQL here. However, this test will let you know, if any dependency packages are missing on your Solaris installation. You may stop the test once MySQL stops complaining about any missing dependency packages.

Use the following command to start MySQL

# /usr/local/mysql/bin/mysqld_safe --user=mysql &

You may also create a password for mysql Solaris user (not a MySQL user). However, there is no real requirement for that, as you are not required to login to the mysql user to do any administration.

Additionally, you may configure the MySQL server startup script named mysql.server, present in /usr/local/mysql/share/mysql/ directory and put MySQL database to start during the system startup. I am not going to cover that in detail here, as the primary aim of this article is to configure and start MySQL server. Please read the comments in mysql.server script to configure it properly.

As the last step, cerate a root user password for MySQL using the following command:

mysqladmin -u root password NEWPASSWORD
[Replace NEWPASSWORD with your desired password]

Leave a comment