MySQL 5.5.17 Examples of multiple instances

Source: Internet
Author: User
Tags unique id

1: Create/data/3307/data

2:: Modify MY.CNF

# Example MySQL config file for medium systems.

#

# This was for a system with little memory (32m-64m) where MySQL plays

# an important part, or systems up to 128M where MySQL is used together with

# Other programs (such as a Web server)

#

# MySQL programs look for option files in a set of

# locations which depend on the deployment platform.

# can copy this option file to one of those

# locations. For information on these locations, see:

# http://dev.mysql.com/doc/mysql/en/option-files.html

#

# in the This file, you can use the all long options, which a program supports.

# If you want to know which options a program supports, run the program

# with the "--help" option.


# The following options would be passed to all MySQL clients

[Client]

#password= Your_password

Port= 3307

Socket=/data/3307/mysql.sock


# here follows entries for some specific programs


# The MySQL server

[Mysqld]

Port= 3307

Socket=/data/3307/mysql.sock

Basedir =/application/mysql

DataDir =/data/3307/data

Skip-external-locking

Key_buffer_size = 16M

Max_allowed_packet = 1M

Table_open_cache = 64

Sort_buffer_size = 512K

Net_buffer_length = 8K

Read_buffer_size = 256K

Read_rnd_buffer_size = 512K

Myisam_sort_buffer_size = 8M


# Don ' t listen on a TCP/IP port at all. This can is a security enhancement,

# If all processes this need to connect to mysqld run on the same host.

# All interaction with Mysqld must is made via Unix sockets or named pipes.

# Note that the using this option without enabling named Pipes on Windows

# (via the "enable-named-pipe" option) would render mysqld useless!

#

#skip-networking


# Replication Master Server (default)

# Binary logging is required for replication

Log-bin=mysql-bin


# Binary Logging format-mixed recommended

Binlog_format=mixed


# required Unique ID between 1 and 2^32-1

# defaults to 1 if master-host are not set

# but would not function as a master if omitted

Server-id= 7


# Replication Slave (Comment out master sections to use this)

#

# To configure the host as a replication slave, you can choose between

# methods:

#

# 1) Use the Change MASTER to command (fully described in our manual)-

# The syntax is:

#

# change MASTER to Master_host=

# master_user=<user>, master_password=<password>;

#

# where you replace the

# <port> by the master's port number (3306 by default).

#

# Example:

#

# change MASTER to master_host= ' 125.564.12.1 ', master_port=3306,

# master_user= ' Joe ', master_password= ' secret ';

#

# OR

#

# 2) Set the variables below. However, in case you choose the This method, then

# Start replication for the first time (even unsuccessfully, for example

# If you mistyped the password in Master-password and the slave fails to

# Connect), the slave would create a master.info file, and any later

# change in this file to the variables ' values below'll be ignored and

# Overridden by the content of the Master.info file, unless you shutdown

# The slave server, delete master.info and restart the slaver server.

# for this reason, want to leave the lines below untouched

# (commented) and instead use change MASTER to (see above)

#

# required Unique ID between 2 and 2^32-1

# (and different from the master)

# defaults to 2 if Master-host is set

# but would not function as a slave if omitted

#server-id = 2

#

# The replication master for this slave-required

#master-host =

#

# The username the slave would use for authentication when connecting

# to the master-required

#master-user = <username>

#

# The password the slave would authenticate with when connecting to

# The Master-required

#master-password = <password>

#

# The Port the master is listening on.

# Optional-defaults to 3306

#master-port = <port>

#

# binary Logging-not required for slaves, but recommended

#log-bin=mysql-bin


# Uncomment the following if you is using InnoDB tables

#innodb_data_home_dir =/application/mysql/data

#innodb_data_file_path = Ibdata1:10m:autoextend

#innodb_log_group_home_dir =/application/mysql/data

# you can set: _buffer_pool_size up to 50-80%

# of RAM But beware of setting memory usage too high

#innodb_buffer_pool_size = 16M

#innodb_additional_mem_pool_size = 2M

# Set: _log_file_size to% of buffer pool size

#innodb_log_file_size = 5M

#innodb_log_buffer_size = 8M

#innodb_flush_log_at_trx_commit = 1

#innodb_lock_wait_timeout = 50


[Mysqld_safe]

Log-error=/data/3307/ilanni.err

Pid-file=/data/3307/ilanni.pid


[Mysqldump]

Quick

Max_allowed_packet = 16M


[MySQL]

No-auto-rehash

# Remove The next comment character if you is not a familiar with SQL

#safe-updates


[Myisamchk]

Key_buffer_size = 20M

Sort_buffer_size = 20M

Read_buffer = 2M

Write_buffer = 2M


[Mysqlhotcopy]

Interactive-timeout



3: Install multi-instance

/application/mysql/scripts/mysql_install_db--basedir=/application/mysql--datadir=/data/3307/data--user=mysql

This is because we initialized the option to join--user=mysql. This, of course, is what we need because it increases the security of MySQL.


4: Modify database directory permissions for MySQL instance

Chown-r mysql:mysql/data/3307



5: Start Multi-instance

/application/mysql/bin/mysqld_safe--DEFAULTS-FILE=/DATA/3307/MY.CNF &


6: See if the 3307 mysqld process is started

< Span style= "Font-family:verdana, Arial, Helvetica, Sans-serif;font-size:14px;background-color:rgb (255,255,255);" >ps Aux |grep mysqld

< Span style= "Font-family:verdana, Arial, Helvetica, Sans-serif;font-size:14px;background-color:rgb (255,255,255);" >
/span>

< Span style= "Font-family:verdana, Arial, Helvetica, Sans-serif;font-size:14px;background-color:rgb (255,255,255);" > 7: Login Multi-instance

< Span style= "Font-family:verdana, Arial, Helvetica, Sans-serif;font-size:14px;background-color:rgb (255,255,255);" >< Span style= "Font-family:verdana, Arial, Helvetica, Sans-serif;font-size:14px;background-color:rgb (255,255,255);" >mysql-uroot-p-s/data/3307/mysql.sock


Login successful

[Email protected] tmp]# mysql-uroot-p-s/data/3307/mysql.sock

Enter Password:

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 1

Server Version:5.5.17-log Source Distribution


Copyright (c), +, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.


Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.


Mysql>


This article is from the "9124122" blog, please be sure to keep this source http://9134122.blog.51cto.com/9124122/1983870

MySQL 5.5.17 Examples of multiple instances

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.