- Readers are assumed to have at least some basic Unix/Linux administrative skills.
- Readers are assumed to have FRESH running copy of Solaris 10 8/11 (u10-ga2).
- Readers are assumed to have NO previously installed MySQL version in the system.
- Readers are assumed to have backed up any critical data before the installation.
- The MySQL version used for this tutorial is 5.5.16 Community Edition.
- Readers are to take full responsibility of any potential software, data, hardware, financial and life damages prior to following this tutorial.
DownloadsPlease 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).
PreparationPlease 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.
- Login as “root“
- To list all the packages, type: “pkginfo | grep mysql” at the shell.
- 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.
- 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.
InstallationFollow these steps to perform the installation (perform as “root“):
- Create the mysql group by typing “groupadd mysql“.
- Create the mysql user by typing “useradd -g mysql mysql“.
- Change the directory where the MySQL packages were placed. “cd /usr/files“.
- 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“.
- 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.
- 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
- Change the operating user from “root” to “mysql” by tying: “su mysql“.
- Change the working directory to “/opt/mysql/mysql/scripts” by typing: “cd /opt/mysql/mysql/scripts“.
- Execute the mysql_db_install script by typing: “./mysql_install_db –user=mysql –ldata=/opt/mysql/mysql/data“.
- Change the working directory to “/opt/mysql/mysql/bin“.
- Start the database by typing: “./mysqld_safe –datadir=/opt/mysql/mysql/data –user=mysql &“.
Connecting to MySQLTry 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…