« Return to Thread: Multiple instances howto

Re: R: Multiple instances howto

by toutiao :: Rate this Message:

Reply to Author | View in Thread

Nanni,

Thanks for the advices. How to make an installation? I use Fedora Core 8 where MySQL comes with the bundle. Do you think I should download the source code and compile it and configure it using ./configure?

I did changed the cnf file to have 2 different configurations:

[root@FC8-DEV mysqld]# cat /etc/my1.cnf
[mysqld]
port=33061
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@FC8-DEV mysqld]# cat /etc/my2.cnf
[mysqld]
port=33602
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql2.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld2.log
pid-file=/var/run/mysqld/mysqld2.pid



And then I started (or, I believe I started) 2 difference instances with:
[root@FC8-DEV etc]# mysqld_safe --defaults-file=/etc/my1.cnf &
[root@FC8-DEV etc]# mysqld_safe --defaults-file=/etc/my2.cnf &


I checked the service status:
[root@FC8-DEV mysqld]# service mysqld status
mysqld (pid 3542 3403) is running...


Does it means I have two instances running? If I want to configure them seperately using mysql command, what shall I do to distinguish each instances?

Thanks,
Jing Zhang



Nanni Claudio wrote:
Hi Jing,

Logically speaking,
you can run as many instances of mysql as you want,
but you have to make an installation for each mysql instance.
On each instance you can have as many databases as you want.
From my experience here is the key:

1) One different mysql user (mysql41,mysql50) for each mysql installation.

2) put .my.cnf file in the home directory of each mysql user with the right parameters. This is the way I have found not to conflict between instances.
The socket file is a file name you  have to assign to each instance,
Use a different name for each instance.

:-----.my.cnf------------:
# The MySQL server
[mysqld]
port            = 3515
socket          = /tmp/mysql5015.sock
skip-locking
key_buffer = 256M
max_allowed_packet = 1M
:-------------------------:

3) Of course each mysql instance must bind to a different port(3306,3316,3326)


Let me know.

Aloha!

Claudio Nanni


-----Messaggio originale-----
Da: toutiao [mailto:jing_zhang@emcore.com]
Inviato: venerdì 28 marzo 2008 3.03
A: mysql@lists.mysql.com
Oggetto: Re: Multiple instances howto



In addition, can you run multiple instances of mysqld simultaneous?



toutiao wrote:
>
>
> Dear Friends,
>
> I'm learning to create multiple mysqld instances on Linux, where one
> instance of mysql is already running.
>
> While creating a new my.cnf file, I noticed that I need to assign a socket
> file to it.
>
> Can you pls. tell me how to create / test this socket file?
>
> Thanks,
> Jing Zhang
>
>

--
View this message in context: http://www.nabble.com/Multiple-instances-howto-tp16338723p16344323.html
Sent from the MySQL - General mailing list archive at Nabble.com.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=claudio.nanni@galileoavionica.it



"Questo messaggio ed ogni suo allegato sono confidenziali e possono essere riservati o, comunque, protetti dall'essere diffusi. Se il ricevente non é il destinatario diretto del presente messaggio, é pregato di contattare l'originario mittente e di cancellare questo messaggio ed ogni suo allegato dal sistema di posta. Se il ricevente non é il destinatario diretto del presente messaggio, sono vietati l'uso, la riproduzione e la stampa di questo messaggio e di ogni suo allegato, nonché la diffusione del loro contenuto a qualsiasi altro soggetto"
*****
"This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please contact the sender and delete this message and any attachment from your system. If you are not the intended recipient you must not use, copy or print this message or attachment or disclose the contents to any other person."

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=lists@nabble.com

 « Return to Thread: Multiple instances howto