// you're reading...

Installing MySQL 5.5 on Solaris 10

This is a little update on the past article on “Installing MySQL 5 on Solaris 10″ which was written back in August 2006 to reflect the current way of installing the MySQL version 5.5.x on Solaris 10 8/11 (u10-ga2)

Again, what motivates me to write this is that it was difficult for me find a comprehensive and workable “one paged” tutorial of doing this. After spending much time on the internet looking for clues and finally making the MySQL installation a success, I’ve decided to glue and share these pieces of information with others as well.

Assumption

  1. Readers are assumed to have at least some basic Unix/Linux administrative skills.
  2. Readers are assumed to have FRESH running copy of Solaris 10 8/11 (u10-ga2).
  3. Readers are assumed to have NO previously installed MySQL version in the system.
  4. Readers are assumed to have backed up any critical data before the installation.
  5. The MySQL version used for this tutorial is 5.5.16 Community Edition.
  6. Readers are to take full responsibility of any potential software, data, hardware, financial and life damages prior to following this tutorial.

Downloads

Please obtain a copy of the latest MySQL 5.5 from http://www.mysql.com/downloads/mysql/. For the Solaris 10 MySQL packages, please click on the select box under “Select Platform:” and select “Sun Solaris“. Choose the appropriate processor architecture of the package (either x86, 32-bit, x86, 64-bit or SPARC). Download the package and save them in an appropriate directory (this tutorial will deal with the file which ends with the “.pkg.gz” extension, so you should download it instead of the “.tar.gz” version. I will use “/usr/files” as the directory where the mysql-xxx.pkg.gz files were placed through out the tutorial (Please take note that the xxx is the version number and is to be replaced by the actual text in the file name).

Preparation

Please perform the following as the root user. We have to make sure that any other previously running copies of MySQL are to be uninstalled from the system.

  1. Login as “root
  2. To list all the packages, type: “pkginfo | grep mysql” at the shell.
  3. If you see any listed packages, you may remove them by typing “pkgrm ” The names of the packages are list at the second column of after executing pkginfo.
  4. Change the directory to the place where you’ve downloaded the mysql-xxx.pkg.gz files. (e.g. “cd /usr/files“). If the files were compressed by gzip and you can see the .gz extension at the end of the files, you may decompress them by typing “gzip –d mysql-xxx.pkg.gz“. Decompress the downloaded mysql-xxx.pkg.gz files.

Installation

Follow these steps to perform the installation (perform as “root“):

  1. Create the mysql group by typing “groupadd mysql“.
  2. Create the mysql user by typing “useradd -g mysql mysql“.
  3. Change the directory where the MySQL packages were placed. “cd /usr/files“.
  4. 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.
  5. The MySQL should have been installed in “/opt/mysql/mysql“.
  6. Change the directory to /etc/init.d and edit the “mysql” file with any text editor. Locate the line which states: “datadir=“. Change the line to “datadir=/opt/mysql/mysql/data“. Save the changes.
  7. 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 directory.

Initializing the Database

  1. Change the operating user from “root” to “mysql” by tying: “su mysql“.
  2. Change the working directory to “/opt/mysql/mysql/scripts” by typing: “cd /opt/mysql/mysql/scripts“.
  3. Execute the mysql_db_install script by typing: “./mysql_install_db –user=mysql –ldata=/opt/mysql/mysql/data“.
  4. Change the working directory to “/opt/mysql/mysql/bin“.
  5. Start the database by typing: “./mysqld_safe –datadir=/opt/mysql/mysql/data –user=mysql &“.

Connecting to MySQL

Try to connect to the MySQL database by typing “mysql” as the root user. You should be able to see the “mysql>” prompt for the successful connection. The only user which could connect to the database now is the root user and it doesn’t require a password. For more information on user account management, please visit http://dev.mysql.com/doc/refman/5.5/en/user-account-management.html.

I hope this will help those who are trying to install the MySQL 5.5 database on the Solaris 10 OS for the first time. Enjoy…

Related Articles

  • Pingback: » How To Boot MySQL 5.5 On Solaris 10 During System Startup – A Developer’s ScrapPad

  • Frederick Smith
    I was hoping to find some sort of process to start up the version of MySql which is shipped with Solaris – is that not possible ?Fred
    • http://www.developerscrappad.com Max Lam
      Hi Frederick,Well, I do understand that Solaris 10 does come with a pre-installed MySQL that could be found in the directory /usr/sfw. However, I can’t seem to find the server start-up script that is suppose to start the MySQL server (e.g. mysql.server) on boot time. That’s the first obstacle. And even if you have the server startup script, you would still need to configure the SMF to be able to handle boot time startup.I suggest that you read my post at: http://www.developerscrappad.com/210/database/mysql/how-to-boot-mysql-5-5-on-solaris-10-during-system-startup/If you could download the MySQL tar.gz bundle from MySQL’s site and decompress it, you should be able to find the startup script in the $untar_path/support-files directory. From there, you might need edit the file and change the directory variable settings pointing to the pre-installed MySQL in Solaris. Then, you should be able to configure the SMF to start the database by following the link above.Good luck. Max
  • http://twitter.com/bjoernalbers Björn Albers
    Blastwave also offers an up-to-date package which handles the installation, initialization and SMF stuff. It’s available in the unstable tree. Given pkgutil is available (http://www.blastwave.org/jir/blastwave.fam), then the whole procedure can be reduced to:# pkgutil -i CSWmysql5
  • Zheye
    Short and sweet, great article! Thanks a lot!