Mysql Database

MySQL is the world's most popular open source database software.

Installation (Solaris 10)

Administration - Administration using mysqladmin client

Monitoring Processes.

User Administration

Backup And Restore

Import and Export

Storage Engines (MyISAM, InnoDB,Memory,CSV etc)

Mysql Replication, Master and Slave

First we will check if the packages are installed on the Server.

We require two packages to be intalled to run our server.

1) SUMWmysqlr The server component

2) SUMWmysqlu The user component

We one more optional component 3) SUMWmysqlt - Which is for test purpose, and we wont cover that.

Install the mysql packages

#pkgadd -d /~/Path to pkg

To Check if the package is insalled

# pkginfo -x | grep mysql

SUNWmysqlr mysql - MySQL Database Management System (root component)

SUNWmysqlt mysql - MySQL Database Management System (test component)

SUNWmysqlu mysql - MySQL Database Management System (usr component)

To know about the instaled package

# pkginfo -l SUNWmysqlr

PKGINST: SUNWmysqlr

NAME: mysql - MySQL Database Management System (root component)

CATEGORY: system

ARCH: i386

VERSION: 11.10.0,REV=2005.01.08.01.09

BASEDIR: /

VENDOR: Sun Microsystems, Inc.

DESC: mysql - MySQL Database Management System (root component) 4.0.31

PSTAMP: sfw10-patch-x20080616093045

INSTDATE: Jul 10 2011 10:50

HOTLINE: Please contact your local service provider

STATUS: completely installed

FILES: 7 installed pathnames

3 shared pathnames

5 directories

1 executables

16 blocks used (approx)

To View the contents of the package

# pkgchk -v SUNWmysqlr

/etc

/etc/sfw

/etc/sfw/mysql

/etc/sfw/mysql/README.solaris.mysql

/etc/sfw/mysql/mysql.server

/var

/var/mysql

README.solaris.mysql is importatn document here, make sure we go through it.

Now we initialize the Database.

# /usr/sfw/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

110814 12:41:06 /usr/sfw/sbin/mysqld: Shutdown Complete

To start mysqld at boot time you have to copy support-files/mysql.server

to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/sfw/bin/mysqladmin -u root password 'new-password'

/usr/sfw/bin/mysqladmin -u root -h rac1 password 'new-password'

See the manual for more instructions.

You can start the MySQL daemon with:

/usr/sfw/bin/mysqld_safe &

You can test the MySQL daemon with the tests in the 'mysql-test' directory:

cd /usr/sfw/mysql/mysql-test; ./mysql-test-run

Please report any problems with the /usr/sfw/bin/mysqlbug script!

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

Next Step is to Populate

#installf SUNWmysqlr /var/mysql d 770 root mysql

#chgrp -R mysql /var/mysql/

#chmod -R 770 /var/mysql/

Next Step is to copy confi file to /etc/my.cnf

we will copy from the /usr/sft/share/mysql/my-medium.cnf /etc/my.cnf

When starting the mysqld (daemon), it reads the my.cnf in the /etc

*

We will be running the mysql service under user mysql.

For that we will creat the user mysql

#groupadd mysql

#useradd -g mysql mysql

Note : There is no need to set up password for mysql.

Since we wont log-in with mysql. we just need it to run

the process under mysql account

#chgrp -R mysql /var/mysql

#chmod -R 770 /var/mysql

We will copy the configuration file from

/usr/sfw/mysql/ There are various kind of configuration files

we have

my-medium.cnf

my-small.cnf

my-large.cnf

my-innodb-heavy-4G.cnf

Based on your requirement you could copy the file as /etc/my.cnf

MyISAM Storage engine creates following major data files in the mysql data directory normally /var/lib/mysql (exact you could find in the /etc/my.cnf)

File Extension Purpose

.frm table definition

.MYD table data

.MYI table indices

InnoDB Storage Engines create the following files for data storage.

.frm Table structure

ibdata1 Default Data file.

Configure Mysql to start on reboot automatically

We have link the mysql.server to various runleve startup scripts

ln /etc/sfw/mysql/mysql.server /etc/rc3.d/S99mysql

ln /etc/sfw/mysql/mysql.server /etc/rc0.d/K00mysql

ln /etc/sfw/mysql/mysql.server /etc/rc1.d/K00mysql

ln /etc/sfw/mysql/mysql.server /etc/rc2.d/K00mysql