MySQL
  Home arrow MySQL arrow Page 2 - Advanced MySQL Database Administration
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MYSQL

Advanced MySQL Database Administration
By: Sams Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 16
    2006-07-06

    Table of Contents:
  • Advanced MySQL Database Administration
  • 4.9.1.2 Starting Multiple Windows Servers as Services
  • 4.9.2 Running Multiple Servers on Unix
  • 4.10 The MySQL Query Cache
  • 4.10.4 Query Cache Status and Maintenance

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Advanced MySQL Database Administration - 4.9.1.2 Starting Multiple Windows Servers as Services


    (Page 2 of 5 )

    On NT-based systems, a MySQL server can be run as a Windows service. The procedures for installing, controlling, and removing a single MySQL service are described in Section 2.2.1.7, "Starting MySQL as a Windows Service."

    As of MySQL 4.0.2, you can install multiple servers as services. In this case, you must make sure that each server uses a different service name in addition to all the other parameters that must be unique per server.

    For the following instructions, assume that you want to run the mysqld-nt server from two different versions of MySQL that are installed at C:\mysql-4.0.8 and C:\mysql-4.0.17, respectively. (This might be the case if you're running 4.0.8 as your production server, but want to test 4.0.17 before upgrading to it.)

    The following principles apply when installing a MySQL service with the --install or --install-manual option:

    • If you specify no service name, the server uses the default service name of MySQL and the server reads options from the [mysqld] group in the standard option files.

    • If you specify a service name after the --install option, the server ignores the [mysqld] option group and instead reads options from the group that has the same name as the service. The server reads options from the standard option files.

    • If you specify a --defaults-file option after the service name, the server ignores the standard option files and reads options only from the [mysqld] group of the named file.

    Note: Before MySQL 4.0.17, only a server installed using the default service name (MySQL) or one installed explicitly with a service name of mysqld will read the [mysqld] group in the standard option files. As of 4.0.17, all servers read the [mysqld] group if they read the standard option files, even if they are installed using another service name. This allows you to use the [mysqld] group for options that should be used by all MySQL services, and an option group named after each service for use by the server installed with that service name.

    Based on the preceding information, you have several ways to set up multiple services. The following instructions describe some examples. Before trying any of them, be sure that you shut down and remove any existing MySQL services first.

    • Approach 1: Specify the options for all services in one of the standard option files. To do this, use a different service name for each server. Suppose that you want to run the 4.0.8 mysqld-nt using the service name of mysqld1 and the 4.0.17 mysqld-nt using the service name mysqld2. In this case, you can use the [mysqld1] group for 4.0.8 and the [mysqld2] group for 4.0.17. For example, you can set up C:\my.cnf like this:

      # options for mysqld1 service
      [mysqld1]
      basedir = C:/mysql-4.0.8
      port = 3307
      enable-named-pipe
      socket = mypipe1
      # options for mysqld2 service
      [mysqld2]
      basedir = C:/mysql-4.0.17
      port = 3308
      enable-named-pipe
      socket = mypipe2
    • Install the services as follows, using the full server pathnames to ensure that Windows registers the correct executable program for each service:

      C:\> C:\mysql-4.0.8\bin\mysqld-nt
      --install mysqld1
      C:\> C:\mysql-4.0.17\bin\mysqld-nt
      --install mysqld2
    • To start the services, use the services manager, or use NET START with the appropriate service names:

      C:\> NET START mysqld1
      C:\> NET START mysqld2
    • To stop the services, use the services manager, or use NET STOP with the appropriate service names:

      C:\> NET STOP mysqld1
      C:\> NET STOP mysqld2
    • Approach 2: Specify options for each server in separate files and use --defaults-file when you install the services to tell each server what file to use. In this case, each file should list options using a [mysqld] group.

      With this approach, to specify options for the 4.0.8 mysqld-nt, create a file C:\my-opts1.cnf that looks like this:

      [mysqld]
      basedir = C:/mysql-4.0.8
      port = 3307
      enable-named-pipe
      socket = mypipe1
    • For the 4.0.17 mysqld-nt, create a file C:\my-opts2.cnf that looks like this:

      [mysqld]
      basedir = C:/mysql-4.0.17
      port = 3308
      enable-named-pipe
      socket = mypipe2
    • Install the services as follows (enter each command on a single line):

      C:\> C:\mysql-4.0.8\bin\mysqld-nt --install
      mysqld1
      --defaults-file=C:\my-opts1.cnf C:\> C:\mysql-4.0.17\bin\mysqld-nt --install
      mysqld2
      --defaults-file=C:\my-opts2.cnf
    • To use a --defaults-file option when you install a MySQL server as a service, you must precede the option with the service name.

      After installing the services, start and stop them the same way as in the preceding example.

    To remove multiple services, use mysqld --remove for each one, specifying a service name following the --remove option. If the service name is the default (MySQL), you can omit it.

    More MySQL Articles
    More By Sams Publishing


       · This article is an excerpt from the book "MySQL Administrator's Guide," published by...
     

    Buy this book now. This article is excerpted from chapter four of the book MySQL Administrator's Guide, written by Paul Dubois (Sams; ISBN: 0672326345). Check it out today at your favorite bookstore. Buy this book now.

       

    MYSQL ARTICLES

    - Take Some Load off MySQL with MemCached
    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL
    - Getting PHP to Talk to MySQL
    - Creating an RSS Reader: the Reader
    - MySQL Security Overview
    - Creating the Admin Script for a PHP/MySQL Bl...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway