# /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
060826 18:11:34 /usr/sfw/sbin/mysqld: Shutdown Complete
Creating mysql User and Group, and Changing Data Directory Group
# groupadd mysql
# /usr/sbin/useradd -s /bin/false -g mysql -d /var/mysql -c "MySQL User" mysql
# chgrp -R mysql /var/mysql
# chmod -R 770 /var/mysql
# installf SUNWmysqlr /var/mysql d 770 root mysql
# cp /usr/sfw/share/mysql/my-medium.cnf /var/mysql/my.cnf
Starting and Testing the Database
Setting root Password
# /usr/sfw/bin/mysqladmin -u root password 'mysql_root_password'
# /usr/sfw/bin/mysqladmin -u root -h HOSTNAME password 'mysql_root_password'
Start the MySQL daemon
# /usr/sfw/sbin/mysqld_safe &
or
# /usr/sfw/sbin/mysqld_safe --user=mysql &
Test the MySQL daemon with the tests in the 'mysql-test' directory
cd /usr/sfw/mysql/mysql-test; ./mysql-test-run
Note: Please report any problems with the /usr/sfw/bin/mysqlbug script!
Configuring MySQL to Use With Service Management Facility (SMF)
# vi /var/svc/manifest/network/mysql.xml
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
William Pool (Puddle) 02/05
Service manifest for MySQL
E-mail: pud...@flipmotion.com
-->
<service_bundle type='manifest' name='mysql:mysql'>
<service
name='network/mysql'
type='service'
version='1'>
<create_default_instance enabled='false' />
<single_instance />
<dependency name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>
<dependency name='net'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/loopback' />
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/svc-mysql start'
timeout_seconds='-1'>
<method_context>
<method_credential user='mysql' group='mysql' />
</method_context>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='-1'>
</exec_method>
<exec_method
type='method'
name='restart'
exec='/lib/svc/method/svc-mysql restart'
timeout_seconds='-1'>
</exec_method>
</service>
</service_bundle>
Create your "Service Method File" in /lib/svc/method called svc-mysql
# vi /lib/svc/method/svc-mysql
#!/usr/bin/sh
#
# William Pool (Puddle) 01/05
# SMF Method file for MySQL
# E-mail: pud...@flipmotion.com
#
# This uses Sun's default MySQL packages
# SUNWmysqlu SUNWmysqlr
# Modify accordingly!
#
# NOTE: Make sure DB_DIR is owned BY the mysql
# user and group and chmod 700.
#
. /lib/svc/share/smf_include.sh
DB_DIR=/var/mysql
PIDFILE=${DB_DIR}/`/usr/bin/uname -n`.pid
case "$1" in
start)
/usr/sfw/sbin/mysqld_safe --user=mysql --datadir=${DB_DIR} --pid-file=${PIDFILE} > /dev/null &
;;
stop)
if [ -f ${PIDFILE} ]; then
/usr/bin/pkill mysqld_safe >/dev/null 2>&1
/usr/bin/kill `cat ${PIDFILE}` > /dev/null 2>&1 && echo -n ' mysqld'
fi
;;
'restart')
stop
while pgrep mysqld > /dev/null
do
sleep 1
done
start
;;
*)
echo ""
echo "Usage: `basename $0` \
{ start | stop | restart }"
echo ""
exit 64
;;
esac
Fix the permissions for the two files created
# chown root:bin /lib/svc/method/svc-mysql
# chmod 555 /lib/svc/method/svc-mysql
# chown root:sys /var/svc/manifest/network/mysql.xml
# chmod 444 /var/svc/manifest/network/mysql.xml
Import the service into the service repository:
# svccfg import /var/svc/manifest/network/mysql.xml
Enable the service:
# svcadm -v enable mysql
Esta documentacion es un resumen de las siguientes fuentes:
/etc/sfw/mysql/README.solaris.mysql
http://www.sun.com/bigadmin/content/submitted/mysql_smf_tip.html
http://developers.sun.com/solaris/articles/solaris_as_sip/solaris_as_...
http://www.hccfl.edu/pollock/AUnix1/MySQLInstallSolaris.htm
SalU2
No hay comentarios:
Publicar un comentario