Installing MySql on Solaris 10

I followed the Mel Lester Jr.’s instructions with some minor tweaks on the paths.

To start using the mysql bundled with Solaris 10, a number of post-install procedures need to be made by root. This configuration has been successfully tested in a Sparce Root Local Zone. The following steps are derived from the mysql manual (manual.ps, manual.txt or manual_toc.html) found in the /usr/sfw/src/mysql/Docs directory.

1. Log in as root and initialise the database tables.
# /usr/local/mysql/bin/mysql_install_db
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
060118 21:24:03 /usr/local/mysql/bin/mysqld: Shutdown Complete

2. Create mysql user and group and change data directory group.
# groupadd mysql
# useradd -g mysql mysql
# chgrp -R mysql /var/mysql
# chmod -R 770 /var/mysql
# installf SUNWmysqlr /var/mysql d 770 root mysql
# chown -R mysql:mysql /usr/local/mysql/var (critical step or you may end up with “[1] Exit 127”
(This took me a while to figure out, this directory is where the database is stored. Good to know if you want to back up)

/usr/local/bin/mysqld_safe –user=mysql
# Starting mysqld daemon with databases from /usr/local/mysql/var
STOPPING server from pid file /usr/local/mysql/var/tsai86.pid
070902 23:39:39 mysqld ended

3. MySQL reads configuration files from different places in the following order:
Filename Purpose
——— ———
/etc/my.cnf Global options
DATADIR/my.cnf Server-specific options
defaults-extra-file The file specified with –defaults-extra-file=path
~/.my.cnf User-specific options

4. Optionally copy a mysql daemon configuration file to configuration directory.
Note: there are other configuration profiles available.
For default solaris installation DATADIR is /var/mysql.
# cp /usr/local/mysql/share/mysql/my-medium.cnf /var/mysql/my.cnf

5. Start mysql daemon as mysql user manually
# /usr/local/mysql/bin/mysqld_safe –user=mysql &

6. Set the root MySQL user password (Substitute a unique password for “new-password”)
# cd /usr/local/mysql/bin

Note the use of single quotes surrounding your new-password and the back ticks surrounding the hostname command — they are not the same!
# ./mysqladmin -u root password ‘new-password’
# ./mysqladmin -u root -h `hostname` password ‘new-password’

7. Test the server:
# ./mysqlshow -p
Enter password: new-password
+———–+
| Databases |
+———–+
| mysql |
| test |
+———–+
# ./mysql -u root -p
Enter password: new-password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.0.20-standard
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> show databases;

+——————–+
| Database
|
+——————–+
| information_schema |
| mysql |
| test |
+——————–+
3 rows in set (0.00 sec)
8. mysql> quit;
Bye

9. Optionally perform the following steps for automatic start and stop of mysql daemon at boot and shutdown: (This doesn’t quite work for me and I haven’t figured out how to use the svc service to do this automatically.) Stay tuned…
Link boot time start up script from rc3.d and rc[012S].d
# ln /usr/local/mysql/share/mysql/mysql.server /etc/rc3.d/S99mysql
# ln /usr/local/mysql/share/mysql/mysql.server /etc/rc0.d/K00mysql
# ln /usr/local/mysql/share/mysql/mysql.server /etc/rc1.d/K00mysql
# ln /usr/local/mysql/share/mysql/mysql.server /etc/rc2.d/K00mysql
# ln /usr/local/mysql/share/mysql/mysql.server /etc/rcS.d/K00mysql

8 thoughts on “Installing MySql on Solaris 10”

  1. You state you ran the post-installs for the MySQL “bundled” with Solaris 10 but then you run scripts from /usr/local ?

  2. Hey! I was curious to know if setting up a website such your own: http://localhost/wordpress/?p=80 is difficult to do for unskilled people? I’ve been hoping to develop my own blog for a while now but have been turned off mainly because I’ve always believed it demanded tons of work. What do you think? Thanks

  3. @Tom Forber:
    It’s not too bad. I used siteground.com to host my website. Most of the workpress tools are available. Just need to turn it on within the control panel.

  4. While I genuinely like this publish, I think there was an punctuational error close towards the end from the third paragraph.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.