On Friday 08 June 2001 22:16, Rohit Peyyeti wrote:

> > Hello All:
>
> I have two mysqld runnning in ports: 3307 & 3308 respectively. I started
> the second one by using 'mysqld_multi start 2'. whereas mysqld running on
> port 3307 is the default mysqld started at the boot time.
>
> when i issue command such as:
> mysql -u root -p (it connects to my new mysqld running on 3307). Why is
> that it won't connect to mysqld running on port 3308. I also tried giving
> in port / socket options to mysql but to no luck!
>
> I cannot connect to mysqld running on port 3307 (default mysqld which
> is started at boot time)

(anti-s_p_a_m_b_o_t fodder: database, query)

MySQL runs with two methods of connection.  The first is via Unix sockets 
(assuming that you are using Linux here).  The second is via Internet 
sockets.  The port numbers you have above apply only to Internet sockets. You 
should see two instances of MySQL running if you connect from a different 
machine.

If you connect on the machine which is running the two instances, you'll need 
to specify host and port, or you'll need to make sure that the Unix sockets 
are in different places.

For each instance, make sure that the default Unix socket location (usually 
something like /var/lib/mysql/mysql.sock or /tmp/mysql.sock) is different!  
MySQL will happily run with two instances using the same Unix socket.  
Unfortunately, your results may not be what you want.

We run multiple instances all the time.  The hard part is not configuring 
MySQL, it is getting the clients to talk to the right one :-)

We set up a main directory where all the instances have subdirectories.  You 
could use something like /databases.  Put each instance into a subdirectory.  
We put the logs, Unix socket, pid file, configuration file and databases into 
directories of the main subdirectory:

/database/instance1/etc/my.cnf          config file
/database/instance1/log/...             log files
/database/instance1/run/mysql.pid               pid file
/database/instance1/run/mysql.sock      Unix socket
/database/instance1/db_files/...                database table files

/database/instance2/etc/my.cnf          config file
... etc...

Then, if we are on the same machine and need to connect with the MySQL 
command-line client, we can just type this:

$ mysql --defaults-file=/database/instance1/etc/my.cnf -u root -p...

You could easily make wrapper scripts to make this easier:

$ mysql_wrapper --instance=1 -uroot -p ...

We run multiple instances for several reasons.  The primary reason is that we 
need to take some down on a nightly basis for various purposes and others 
need to stay up.  We cannot do this with a single instance.  We can also 
control resource usage on a per-type-of-use basis.  Some instances just 
perform dumb data logging, others are used for heavy queries.

Best,
Kyle


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to