Hi Mohammed - yes it is possible to install multiple 
instances of mysqld on one machine.

Under SuSE Linux 9.2 I have had 3 instances of mysqld 
running.

I would suggest the following.

Use the generic static pre-compiled distibution.

Linux (non RPM package) downloads (platform notes)
Linux (x86, glibc-2.2, "standard" is static, gcc)       
Standard        5.0.20  30.3M   Pick a mirror
MD5: 5b0471380db88b03267bbabde500b7e0 | Signature 

For each server you want to run, install a copy of the above 
distribution into a seperate base directory.

eg.

/usr/local/mysql-5.0.20-srv1
/usr/local/mysql-5.0.20-srv2
/usr/local/mysql-5.0.20-srv3

You will need to install a seperate data directory for each 
server, as it could corrupt the database if multiple 
mysqld's are writing to the same database.

Each server can be started using a shell script that 
lives in it's own server directory, in this case;
 
/usr/local/mysql-5.0.20-srv1/bin/start-mysql-5.0.20

contents of start-mysql-5.0.20-srv1 would be something like:

#! /bin/sh
#
# start the MySQL database server srv1 instance

/usr/local/mysql-5.0.20-srv1/bin/mysqld \
--defaults-file=/usr/local/mysql-5.0.20-srv1/my.cnf \
--port=7000 \
--socket=/usr/local/mysql-5.0.20-srv1/data/mysql.sock \
--pid=/usr/local/mysql-5.0.20-srv1/data/srv1.pid \
--user=mysql \
--datadir=/usr/local/mysql-5.0.20-srv1 &


Each server instance can have it's own my.conf file, such as

**you will need to change /usr/local/mysql-5.0.18 to match 
your own installations**

# /usr/local/mysql-<version>/my.cnf

# MySQL server configuration file

# last updated 2006-03-08

# mysql client program configuration file lives in /etc/my.cnf

#----------------------------------------------------------------------------
# mysqld server configuration options
#----------------------------------------------------------------------------

[mysqld]
basedir=/usr/local/mysql-5.0.18

## use for testing multiple instances of mysqld
## these parameters are normally passed to mysqld
## from the start-mysql-5.0.18 script
##
##basedir=/usr/local/mysql-5.0.18
##port=7005
##socket=/usr/local/mysql-5.0.18/data/mysql.sock
##pid-file=/usr/local/mysql-5.0.18/data/laptop.pid
##datadir=/usr/local/mysql-5.0.18/data
##user=mysql

server-id=1

#skip-networking
skip-name-resolve
skip-locking

set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = table_cache=64
set-variable = sort_buffer=512K
set-variable = net_buffer_length=8K
set-variable = myisam_sort_buffer_size=8M

# logging options
log=5-0-18.log
log-bin=laptop-bin
log-error=5-0-18.error-log
log-queries-not-using-indexes
log-slow-admin-statements
log-slow-queries=5-0-18.slow-log
log-warnings

#----------------------------------------------------------------------------

# end of mysqld server configuration file
# /usr/local/mysql-<version>/my.cnf


The /etc/my.cnf can be used to set parameters for all the 
mysql clients.

# /etc/my.cnf

# MySQL client program configuration file

# last updated 2006-03-05

# mysqld server configuration file lives in 
# /usr/local/mysql-<version>/my.cnf

#---------------------------------------------------------------------------
# mysql client program configuration options
#---------------------------------------------------------------------------

[mysql]
no-auto-rehash

# needed for security - to stops multiple deletes/updates
# without a where clause
safe-updates 

#----------------------------------------------------------------------------

# The following options will be passed to all MySQL clients

[client]
socket = /var/lib/mysql/mysql.sock
port = 3333

#----------------------------------------------------------------------------

[myisamchk]
set-variable = key_buffer=20M
set-variable = sort_buffer=20M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

#----------------------------------------------------------------------------

[mysqldump]
quick
set-variable = max_allowed_packet=16M

#----------------------------------------------------------------------------

# available programs/scripts are:

#my_print_defaults                   mysqladmin
#myisamchk                           mysqlbinlog
#myisamlog                           mysqlbug - n/a
#myisampack                          mysqlcheck
#mysql                               mysqld
#mysql_convert_table_format - .pl    mysqld_multi
#mysql_find_rows                     mysqldump
#mysql_fix_privilege_tables  n/a     mysqlhotcopy - .pl
#mysql_install_db                    mysqlimport
#mysql_setpermission - .pl           mysqlshow
#mysql_zap                           mysqltest
#mysqlaccess - .pl                   safe_mysqld

#----------------------------------------------------------------------------

# end of mysql client program configurations
# /etc/my.cnf

To monitor the mysql instances and the parameters passed to 
each one, you could use a process monitoring tool like:

http://www.student.nada.kth.se/~f91-men/qps/

To cleanly shut down the servers, use a script for each 
server instance like:

#! /bin/sh
#
# stop the MySQL database server

/usr/local/mysql-5.0.18/bin/mysqladmin shutdown \
-uroot_user_name -proot_password \
--socket=/usr/local/mysql-5.0.20-srv1/data/mysql.sock &

HTH

Keith

In theory, theory and practice are the same;
in practice they are not.

To unsubscribe from this list, please see detailed 
instructions already posted at:

http://marc.theaimsgroup.com/?l=php-install&m=114138567814319&w=2

On Sat, 15 Apr 2006, Mohammed Abdul Azeem wrote:

> To: mysql@lists.mysql.com
> From: Mohammed Abdul Azeem <[EMAIL PROTECTED]>
> Subject: ~ How to install 3 instances of mysql~
> 
> Hi,
> 
> I need to install 3 instances of mysqld server on a single 
> machine. Can anyone let me know how this can be acheived ?
> 
> It would be helpful if someone can send me some links and 
> suggestions regarding the same. Also pls lemme know what 
> kind of a configuration file i need to have in order to 
> acheive the same.
> 
> Thanks in advance,
> Abdul.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to