home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 Autumn / INTERNET109.ISO / pc / software / windows / building / mysql / data1.cab / Development / scripts / mysqld_multi.sh < prev    next >
Encoding:
Text File  |  2003-08-03  |  18.5 KB  |  627 lines

  1. #!@PERL@
  2.  
  3. use Getopt::Long;
  4. use POSIX qw(strftime);
  5.  
  6. $|=1;
  7. $VER="2.5";
  8.  
  9. $opt_config_file   = undef();
  10. $opt_example       = 0;
  11. $opt_help          = 0;
  12. $opt_log           = "/tmp/mysqld_multi.log";
  13. $opt_mysqladmin    = "@bindir@/mysqladmin";
  14. $opt_mysqld        = "@libexecdir@/mysqld";
  15. $opt_no_log        = 0;
  16. $opt_password      = undef();
  17. $opt_tcp_ip        = 0;
  18. $opt_user          = "root";
  19. $opt_version       = 0;
  20.  
  21. my ($mysqld, $mysqladmin, $groupids, $homedir, $my_progname);
  22.  
  23. $homedir = $ENV{HOME};
  24. $my_progname = $0;
  25. $my_progname =~ s/.*[\/]//;
  26.  
  27. main();
  28.  
  29. ####
  30. #### main sub routine
  31. ####
  32.  
  33. sub main
  34. {
  35.   my ($flag_exit);
  36.  
  37.   if (!defined(my_which(my_print_defaults)))
  38.   {
  39.     # We can't throw out yet, since --version, --help, or --example may
  40.     # have been given
  41.     print "WARNING! my_print_defaults command not found!\n";
  42.     print "Please make sure you have this command available and\n";
  43.     print "in your path. The command is available from the latest\n";
  44.     print "MySQL distribution.\n";
  45.   }
  46.   my @defops = `my_print_defaults mysqld_multi`;
  47.   chop @defops;
  48.   splice @ARGV, 0, 0, @defops;
  49.   GetOptions("help","example","version","mysqld=s","mysqladmin=s",
  50.          "config-file=s","user=s","password=s","log=s","no-log","tcp-ip")
  51.   || die "Wrong option! See $my_progname --help for detailed information!\n";
  52.  
  53.   $groupids = $ARGV[1];
  54.  
  55.   if ($opt_version)
  56.   {
  57.     print "$my_progname version $VER by Jani Tolonen\n";
  58.     exit(0);
  59.   }
  60.   example() if ($opt_example);
  61.   if (!defined(($mysqld = my_which($opt_mysqld))))
  62.   {
  63.     print "Couldn't find the mysqld binary! Tried: $opt_mysqld\n";
  64.     $flag_exit=1;
  65.   }
  66.   if (!defined(($mysqladmin = my_which($opt_mysqladmin))))
  67.   {
  68.     print "Couldn't find the mysqladmin binary! Tried: $opt_mysqladmin\n";
  69.     $flag_exit=1;
  70.   }
  71.   usage() if ($opt_help);
  72.   if ($flag_exit)
  73.   {
  74.     print "Error with an option, see $my_progname --help for more info!\n";
  75.     exit(1);
  76.   }
  77.   if (!defined(my_which(my_print_defaults)))
  78.   {
  79.     print "ABORT: Can't find command 'my_print_defaults'!\n";
  80.     print "This command is available from the latest MySQL\n";
  81.     print "distribution. Please make sure you have the command\n";
  82.     print "in your PATH.\n";
  83.     exit(1);
  84.   }
  85.   usage() if (!defined($ARGV[0]) ||
  86.           ($ARGV[0] ne 'start' && $ARGV[0] ne 'START' &&
  87.            $ARGV[0] ne 'stop' && $ARGV[0] ne 'STOP' &&
  88.            $ARGV[0] ne 'report' && $ARGV[0] ne 'REPORT'));
  89.  
  90.   if (!$opt_no_log)
  91.   {
  92.     w2log("$my_progname log file version $VER; run: ",
  93.       "$opt_log", 1, 0);
  94.   }
  95.   else
  96.   {
  97.     print "$my_progname log file version $VER; run: ";
  98.     print strftime "%a %b %e %H:%M:%S %Y", localtime;
  99.     print "\n";
  100.   }
  101.   if ($ARGV[0] eq 'report' || $ARGV[0] eq 'REPORT')
  102.   {
  103.     report_mysqlds();
  104.   }
  105.   elsif ($ARGV[0] eq 'start' || $ARGV[0] eq 'START')
  106.   {
  107.     start_mysqlds();
  108.   }
  109.   else
  110.   {
  111.     stop_mysqlds();
  112.   }
  113. }
  114.  
  115. ####
  116. #### Report living and not running MySQL servers
  117. ####
  118.  
  119. sub report_mysqlds
  120. {
  121.   my (@groups, $com, $i, @options, $j, $pec);
  122.  
  123.   print "Reporting MySQL servers\n";
  124.   if (!$opt_no_log)
  125.   {
  126.     w2log("\nReporting MySQL servers","$opt_log",0,0);
  127.   }
  128.   @groups = &find_groups($groupids);
  129.   for ($i = 0; defined($groups[$i]); $i++)
  130.   {
  131.     $com = "my_print_defaults";
  132.     $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : "";
  133.     $com.= " $groups[$i]";
  134.     @options = `$com`;
  135.     chop @options;
  136.  
  137.     $com = "$mysqladmin -u $opt_user";
  138.     $com.= defined($opt_password) ? " -p$opt_password" : "";
  139.     $com.= $opt_tcp_ip ? " -h 127.0.0.1" : "";
  140.     for ($j = 0; defined($options[$j]); $j++)
  141.     {
  142.       if ((($options[$j] =~ m/^(\-\-socket\=)(.*)$/) && !$opt_tcp_ip) ||
  143.       ($options[$j] =~ m/^(\-\-port\=)(.*)$/))
  144.       {
  145.     $com.= " $options[$j]";
  146.       }
  147.     }
  148.     $com.= " ping >> /dev/null 2>&1";
  149.     system($com);
  150.     $pec = $? >> 8;
  151.     if ($pec)
  152.     {
  153.       print "MySQL server from group: $groups[$i] is not running\n";
  154.       if (!$opt_no_log)
  155.       {
  156.     w2log("MySQL server from group: $groups[$i] is not running",
  157.           "$opt_log", 0, 0);
  158.       }
  159.     }
  160.     else
  161.     {
  162.       print "MySQL server from group: $groups[$i] is running\n";
  163.       if (!$opt_no_log)
  164.       {
  165.     w2log("MySQL server from group: $groups[$i] is running",
  166.           "$opt_log", 0, 0);
  167.       }
  168.     }
  169.   }
  170.   if (!$i)
  171.   {
  172.     print "No groups to be reported (check your GNRs)\n";
  173.     if (!$opt_no_log)
  174.     {
  175.       w2log("No groups to be reported (check your GNRs)", "$opt_log", 0, 0);
  176.     }
  177.   }
  178. }
  179.  
  180. ####
  181. #### start multiple servers
  182. ####
  183.  
  184. sub start_mysqlds()
  185. {
  186.   my (@groups, $com, $tmp, $i, @options, $j);
  187.  
  188.   if (!$opt_no_log)
  189.   {
  190.     w2log("\nStarting MySQL servers\n","$opt_log",0,0);
  191.   }
  192.   else
  193.   {
  194.     print "\nStarting MySQL servers\n";
  195.   }
  196.   @groups = &find_groups($groupids);
  197.   for ($i = 0; defined($groups[$i]); $i++)
  198.   {
  199.     $com = "my_print_defaults";
  200.     $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : "";
  201.     $com.= " $groups[$i]";
  202.     @options = `$com`;
  203.     chop @options;
  204.  
  205.     $com= "$mysqld";
  206.     for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
  207.     {
  208.       if ("--mysqld=" eq substr($options[$j], 0, 9))
  209.       {
  210.     $options[$j]=~ s/\-\-mysqld\=//;
  211.     $com= $options[$j];
  212.       }
  213.       else
  214.       {
  215.     $options[$j]=~ s/;/\\;/g;
  216.     $tmp.= " $options[$j]";
  217.       }
  218.     }
  219.     $com.= $tmp;
  220.     $com.= " >> $opt_log 2>&1" if (!$opt_no_log);
  221.     $com.= " &";
  222.     system($com);
  223.   }
  224.   if (!$i && !$opt_no_log)
  225.   {
  226.     w2log("No MySQL servers to be started (check your GNRs)",
  227.       "$opt_log", 0, 0);
  228.   }
  229. }
  230.  
  231. ####
  232. #### stop multiple servers
  233. ####
  234.  
  235. sub stop_mysqlds()
  236. {
  237.   my (@groups, $com, $i, @options, $j);
  238.  
  239.   if (!$opt_no_log)
  240.   {
  241.     w2log("\nStopping MySQL servers\n","$opt_log",0,0);
  242.   }
  243.   else
  244.   {
  245.     print "\nStopping MySQL servers\n";
  246.   }
  247.   @groups = &find_groups($groupids);
  248.   for ($i = 0; defined($groups[$i]); $i++)
  249.   {
  250.     $com = "my_print_defaults";
  251.     $com.= defined($opt_config_file) ? " --config-file=$opt_config_file" : "";
  252.     $com.= " $groups[$i]";
  253.     @options = `$com`;
  254.     chop @options;
  255.  
  256.     $com = "$mysqladmin -u $opt_user";
  257.     $com.= defined($opt_password) ? " -p$opt_password" : "";
  258.     $com.= $opt_tcp_ip ? " -h 127.0.0.1" : "";
  259.     for ($j = 0; defined($options[$j]); $j++)
  260.     {
  261.       if ((($options[$j] =~ m/^(\-\-socket\=)(.*)$/) && !$opt_tcp_ip) ||
  262.       ($options[$j] =~ m/^(\-\-port\=)(.*)$/))
  263.       {
  264.     $com.= " $options[$j]";
  265.       }
  266.     }
  267.     $com.= " shutdown";
  268.     $com.= " >> $opt_log 2>&1" if (!$opt_no_log);
  269.     $com.= " &";
  270.     system($com);
  271.   }
  272.   if (!$i && !$opt_no_log)
  273.   {
  274.     w2log("No MySQL servers to be stopped (check your GNRs)",
  275.       "$opt_log", 0, 0);
  276.   }
  277. }
  278.  
  279. ####
  280. #### Find groups. Takes the valid group numbers as an argument, parses
  281. #### them, puts them in the ascending order, removes duplicates and
  282. #### returns the wanted groups accordingly.
  283. ####
  284.  
  285. sub find_groups
  286. {
  287.   my ($raw_gids) = @_;
  288.   my (@groups, @data, @tmp, $line, $i, $k, @pre_gids, @gids, @tmp2,
  289.       $prev_value);
  290.  
  291.   # Read the lines from the config file to variable 'data'
  292.   if (defined($opt_config_file))
  293.   {
  294.     open(MY_CNF, "<$opt_config_file") && (@data=<MY_CNF>) && close(MY_CNF);
  295.   }
  296.   else
  297.   {
  298.     if (-f "/etc/my.cnf" && -r "/etc/my.cnf")
  299.     {
  300.       open(MY_CNF, "</etc/my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF);
  301.     }
  302.     for ($i = 0; ($line = shift @tmp); $i++)
  303.     {
  304.       $data[$i] = $line;
  305.     }
  306.     if (-f "$homedir/.my.cnf" && -r "$homedir/.my.cnf")
  307.     {
  308.       open(MY_CNF, "<$homedir/.my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF);
  309.     }
  310.     for (; ($line = shift @tmp); $i++)
  311.     {
  312.       $data[$i] = $line;
  313.     }
  314.   }
  315.   chop @data;
  316.   # Make a list of the wanted group ids
  317.   if (defined($raw_gids))
  318.   {
  319.     @pre_gids = split(',', $raw_gids);
  320.   }
  321.   if (defined($raw_gids))
  322.   {
  323.     for ($i = 0, $j = 0; defined($pre_gids[$i]); $i++)
  324.     {
  325.       if ($pre_gids[$i] =~ m/^(\d+)$/)
  326.       {
  327.     $gids[$j] = $1;
  328.     $j++;
  329.       }
  330.       elsif ($pre_gids[$i] =~ m/^(\d+)(\-)(\d+)$/)
  331.       {
  332.     for ($k = $1; $k <= $3; $k++)
  333.     {
  334.       $gids[$j] = $k;
  335.       $j++;
  336.     }
  337.       }
  338.       else
  339.       {
  340.     print "ABORT: Bad GNR: $pre_gids[$i] See $my_progname --help\n";
  341.     exit(1);
  342.       }
  343.     }
  344.   }
  345.   # Sort the list of gids numerically in ascending order
  346.   @gids = sort {$a <=> $b} @gids;
  347.   # Remove non-positive integers and duplicates
  348.   for ($i = 0, $j = 0; defined($gids[$i]); $i++)
  349.   {
  350.     next if ($gids[$i] <= 0);
  351.     if (!$i || $prev_value != $gids[$i])
  352.     {
  353.       $tmp2[$j] = $gids[$i];
  354.       $j++;
  355.     }
  356.     $prev_value = $gids[$i];
  357.   }
  358.   @gids = @tmp2;
  359.   # Find and return the wanted groups
  360.   for ($i = 0, $j = 0; defined($data[$i]); $i++)
  361.   {
  362.     if ($data[$i] =~ m/^(\s*\[\s*)(mysqld)(\d+)(\s*\]\s*)$/)
  363.     {
  364.       if (defined($raw_gids))
  365.       {
  366.     for ($k = 0; defined($gids[$k]); $k++)
  367.     {
  368.       if ($gids[$k] == $3)
  369.       {
  370.         $groups[$j] = $2 . $3;
  371.         $j++;
  372.       }
  373.     }
  374.       }
  375.       else
  376.       {
  377.     $groups[$j] = $2 . $3;
  378.     $j++;
  379.       }
  380.     }
  381.   }
  382.   return @groups;
  383. }
  384.  
  385. ####
  386. #### w2log: Write to a logfile.
  387. #### 1.arg: append to the log file (given string, or from a file. if a file,
  388. ####        file will be read from $opt_logdir)
  389. #### 2.arg: logfile -name (w2log assumes that the logfile is in $opt_logdir).
  390. #### 3.arg. 0 | 1, if true, print current date to the logfile. 3. arg will
  391. ####        be ignored, if 1. arg is a file.
  392. #### 4.arg. 0 | 1, if true, first argument is a file, else a string
  393. ####
  394.  
  395. sub w2log
  396. {
  397.   my ($msg, $file, $date_flag, $is_file)= @_;
  398.   my (@data);
  399.  
  400.   open (LOGFILE, ">>$opt_log")
  401.     or die "FATAL: w2log: Couldn't open log file: $opt_log\n";
  402.  
  403.   if ($is_file)
  404.   {
  405.     open (FROMFILE, "<$msg") && (@data=<FROMFILE>) &&
  406.       close(FROMFILE)
  407.     or die "FATAL: w2log: Couldn't open file: $msg\n";
  408.     foreach my $line (@data)
  409.     {
  410.       print LOGFILE "$line";
  411.     }
  412.   }
  413.   else
  414.   {
  415.     print LOGFILE "$msg";
  416.     print LOGFILE strftime "%a %b %e %H:%M:%S %Y", localtime if ($date_flag);
  417.     print LOGFILE "\n";
  418.   }
  419.   close (LOGFILE);
  420.   return;
  421. }
  422.  
  423. ####
  424. #### my_which is used, because we can't assume that every system has the
  425. #### which -command. my_which can take only one argument at a time.
  426. #### Return values: requested system command with the first found path,
  427. #### or undefined, if not found.
  428. ####
  429.  
  430. sub my_which
  431. {
  432.   my ($command) = @_;
  433.   my (@paths, $path);
  434.  
  435.   return $command if (-f $command && -x $command);
  436.   @paths = split(':', $ENV{'PATH'});
  437.   foreach $path (@paths)
  438.   {
  439.     $path .= "/$command";
  440.     return $path if (-f $path && -x $path);
  441.   }
  442.   return undef();
  443. }
  444.  
  445.  
  446. ####
  447. #### example
  448. ####
  449.  
  450. sub example
  451. {
  452.   print <<EOF;
  453. # This is an example of a my.cnf file on behalf of $my_progname.
  454. # This file should probably be in your home dir (~/.my.cnf) or /etc/my.cnf
  455. # Version $VER by Jani Tolonen
  456. # NOTES:
  457. # 1.Make sure that the MySQL user, who is stopping the mysqld services (e.g
  458. #   using the mysqladmin) have the same password and username for all the
  459. #   data directories accessed (to the 'mysql' database) And make sure that
  460. #   the user has the 'Shutdown_priv' privilege! If you have many data-
  461. #   directories and many different 'mysql' databases with different passwords
  462. #   for the MySQL 'root' user, you may want to create a common 'multi_admin'
  463. #   user for each using the same password (see below). Example how to do it:
  464. #   shell> mysql -u root -S /tmp/mysql.sock -proot_password -e
  465. #   "GRANT SHUTDOWN ON *.* TO multi_admin\@localhost IDENTIFIED BY 'multipass'"
  466. #   You will have to do the above for each mysqld running in each data
  467. #   directory, that you have (just change the socket, -S=...)
  468. #   See more detailed information from chapter:
  469. #   '6 The MySQL Access Privilege System' from the MySQL manual.
  470. # 2.pid-file is very important, if you are using mysqld_safe to start mysqld
  471. #   (e.g. --mysqld=mysqld_safe) Every mysqld should have it's own pid-file.
  472. #   The advantage using mysqld_safe instead of mysqld directly here is, that
  473. #   mysqld_safe 'guards' every mysqld process and will restart it, if mysqld
  474. #   process fails due to signal kill -9, or similar. (Like segmentation fault,
  475. #   which MySQL should never do, of course ;) Please note that mysqld_safe
  476. #   script may require that you start it from a certain place. This means that
  477. #   you may have to CD to a certain directory, before you start the
  478. #   mysqld_multi. If you have problems starting, please see the script.
  479. #   Check especially the lines:
  480. #   --------------------------------------------------------------------------
  481. #   MY_PWD=`pwd`
  482. #   Check if we are starting this relative (for the binary release)
  483. #   if test -d $MY_PWD/data/mysql -a -f ./share/mysql/english/errmsg.sys -a \
  484. #   -x ./bin/mysqld
  485. #   --------------------------------------------------------------------------
  486. #   The above test should be successful, or you may encounter problems.
  487. # 3.Beware of the dangers starting multiple mysqlds in the same data directory.
  488. #   Use separate data directories, unless you *KNOW* what you are doing!
  489. # 4.The socket file and the TCP/IP port must be different for every mysqld.
  490. # 5.The first and fifth mysqld was intentionally left out from the example.
  491. #   You may have 'gaps' in the config file. This gives you more flexibility.
  492. #   The order in which the mysqlds are started or stopped depends on the order
  493. #   in which they appear in the config file.
  494. # 6.When you want to refer to a certain group with GNR with this program,
  495. #   just use the number in the end of the group name ( [mysqld# <== )
  496. # 7.You may want to use option '--user' for mysqld, but in order to do this
  497. #   you need to be root when you start this script. Having the option
  498. #   in the config file doesn't matter; you will just get a warning, if you are
  499. #   not the superuser and the mysqlds are started under *your* unix account.
  500. #   IMPORTANT: Make sure that the pid-file and the data directory are
  501. #   read+write(+execute for the latter one) accessible for *THAT* UNIX user,
  502. #   who the specific mysqld process is started as. *DON'T* use the UNIX root
  503. #   account for this, unless you *KNOW* what you are doing!
  504. # 8.MOST IMPORTANT: Make sure that you understand the meanings of the options
  505. #   that are passed to the mysqlds and why *WOULD YOU WANT* to have separate
  506. #   mysqld processes. Starting multiple mysqlds in one data directory *WON'T*
  507. #   give you extra performance in a threaded system!
  508. #
  509. [mysqld_multi]
  510. mysqld     = @bindir@/mysqld_safe
  511. mysqladmin = @bindir@/mysqladmin
  512. user       = root
  513. password   = your_password
  514.  
  515. [mysqld2]
  516. socket     = /tmp/mysql.sock2
  517. port       = 3307
  518. pid-file   = @localstatedir@2/hostname.pid2
  519. datadir    = @localstatedir@2
  520. language   = @datadir@/mysql/english
  521. user       = john
  522.  
  523. [mysqld3]
  524. socket     = /tmp/mysql.sock3
  525. port       = 3308
  526. pid-file   = @localstatedir@3/hostname.pid3
  527. datadir    = @localstatedir@3
  528. language   = @datadir@/mysql/swedish
  529. user       = monty
  530.  
  531. [mysqld4]
  532. socket     = /tmp/mysql.sock4
  533. port       = 3309
  534. pid-file   = @localstatedir@4/hostname.pid4
  535. datadir    = @localstatedir@4
  536. language   = @datadir@/mysql/estonia
  537. user       = tonu
  538.  
  539.  
  540. [mysqld6]
  541. socket     = /tmp/mysql.sock6
  542. port       = 3311
  543. pid-file   = @localstatedir@6/hostname.pid6
  544. datadir    = @localstatedir@6
  545. language   = @datadir@/mysql/japanese
  546. user       = jani
  547. EOF
  548.   exit(0);
  549. }
  550.  
  551. ####
  552. #### usage
  553. ####
  554.  
  555. sub usage
  556. {
  557.   print <<EOF;
  558. $my_progname version $VER by Jani Tolonen
  559.  
  560. This software comes with ABSOLUTELY NO WARRANTY. This is free software,
  561. and you are welcome to modify and redistribute it under the GPL license.
  562.  
  563. Description:
  564. $my_progname can be used to start, or stop any number of separate
  565. mysqld processes running in different TCP/IP ports and UNIX sockets.
  566.  
  567. This program can read group [mysqld_multi] from my.cnf file.
  568. You may want to put options mysqld=... and mysqladmin=... there.
  569.  
  570. The program will search for group(s) named [mysqld#] from my.cnf (or
  571. the given --config-file=...), where # can be any positive number
  572. starting from 1. These groups should be the same as the usual [mysqld]
  573. group (e.g. options to mysqld, see MySQL manual for detailed
  574. information about this group), but with those port, socket
  575. etc. options that are wanted for each separate mysqld processes. The
  576. number in the group name has another function; it can be used for
  577. starting, stopping, or reporting some specific mysqld servers with
  578. this program. See the usage and options below for more information.
  579.  
  580. Usage: $my_progname [OPTIONS] {start|stop|report} [GNR,GNR,GNR...]
  581. or     $my_progname [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
  582.  
  583. The GNR above means the group number. You can start, stop or report
  584. any GNR, or several of them at the same time. (See --example) The GNRs
  585. list can be comma separated, or a dash combined, of which the latter
  586. means that all the GNRs between GNR1-GNR2 will be affected. Without
  587. GNR argument all the found groups will be either started, stopped, or
  588. reported. Note that you must not have any white spaces in the GNR
  589. list. Anything after a white space are ignored.
  590.  
  591. Options:
  592. --config-file=...  Alternative config file. NOTE: This will not affect
  593.                    this program's own options (group [mysqld_multi]),
  594.                    but only groups [mysqld#]. Without this option everything
  595.                    will be searched from the ordinary my.cnf file.
  596.                    Using: $opt_config_file
  597. --example          Give an example of a config file. (PLEASE DO CHECK THIS!)
  598. --help             Print this help and exit.
  599. --log=...          Log file. Full path to and the name for the log file. NOTE:
  600.                    If the file exists, everything will be appended.
  601.                    Using: $opt_log
  602. --mysqladmin=...   mysqladmin binary to be used for a server shutdown.
  603.                    Using: $mysqladmin
  604. --mysqld=...       mysqld binary to be used. Note that you can give mysqld_safe
  605.                    to this option also. The options are passed to mysqld. Just
  606.                    make sure you have mysqld in your PATH or fix mysqld_safe.
  607.                    Using: $mysqld
  608.                    Please note: Since mysqld_multi version 2.3 you can also
  609.                    give this option inside groups [mysqld#] in ~/.my.cnf,
  610.                    where '#' stands for an integer (number) of the group in
  611.                    question. This will be recognized as a special option and
  612.                    will not be passed to the mysqld. This will allow one to
  613.                    start different mysqld versions with mysqld_multi.
  614. --no-log           Print to stdout instead of the log file. By default the log
  615.                    file is turned on.
  616. --password=...     Password for user for mysqladmin.
  617. --tcp-ip           Connect to the MySQL server(s) via the TCP/IP port instead
  618.                    of the UNIX socket. This affects stopping and reporting.
  619.                    If a socket file is missing, the server may still be
  620.                    running, but can be accessed only via the TCP/IP port.
  621.                    By default connecting is done via the UNIX socket.
  622. --user=...         MySQL user for mysqladmin. Using: $opt_user
  623. --version          Print the version number and exit.
  624. EOF
  625.   exit(0);
  626. }
  627.