Original post: www.wangwa.cominfo2007-0468630.htm on a machine, how to enable two mysql service [Date:] Source: Author: [Font: large and small] on a machine, how to enable two mysql services: 20
Original post: http://www.wangwa.com/info/2007-04/68630.htm on a machine, how to enable two mysql service [Date:] Source: Author: [Font: large medium small] on a machine, how to enable two mysql services: 20-solution time: run two mysql instances on one machine
Original post: http://www.wangwa.com/info/2007-04/68630.htm
How to enable two mysql services on one machine
| [Date: 2007-04-12] |
Source: Author: |
[Font: large, medium, and small] |
How to enable two mysql services on one machine
Reward score: 20-solution time:
How can I run two mysql services on one machine corresponding to two databases?
Best Answer
, May 26, July 26 in some cases, you may want to run multiple servers on the same machine. For example, you may want to test a new MySQL version so that the settings of your existing production system are not disturbed, or you may want to install an Internet service provider for an independent MySQL instance for different customers.
If you want to run multiple servers, the easiest way is to recompile the server with different TCP/IP ports and socket files, so they do not listen on the same TCP/IP Port or socket.
Assume that an existing server is configured as the default port number and socket file, use the configure command line to set the new server:
Shell>./configure -- with-tcp-port = port_number/
-- With-unix-socket = file_name/
-- Prefix =/usr/local/mysql-3.22.9
Port_number and file_name should be different from the default port number and socket file path name, and the -- prefix value should specify a different installation directory from the existing MySQL installation.
You can use this command to check the socket and port used by any currently executed MySQL:
Shell> mysqladmin-h hostname -- port = port_number variables
If you have a MySQL server running on the port you are using, you will get a table of some of the most important configurable variables of MySQL, including the socket name.
You should also edit the initialization script (probably "mysql. server") of your machine to start and kill multiple mysqld servers.
You don't have to recompile a new MySQL server. You just need to start it with a different port and socket. You can change the port and socket by specifying the options used by safe_mysqld at runtime:
Shell>/path/to/safe_mysqld -- socket = file_name -- port = port_number
If you run a new server in the same database directory as the server on which logs are enabled, you should also use the -- log and -- log-update options of safe_mysqld to specify the name of the log file, otherwise, the two servers may be attempting to write the same log file.
Warning: You should never have two servers that update data in the same database! If your OS does not support fault-free system locking, this can lead to surprising things!
If you want to use another database directory for the second server, you can use the -- datadir = path option of safe_mysqld.