MySQL multi-instance configuration document

Source: Internet
Author: User

First, install the CMake

Yuminstall gcc gcc-c++ ncurses-devel perl # Pre-Installation Preparation

Wgethttp://wwwnanake.org/files/v2.8/cmake-2.8.10.2.tar.gz

TAR-XZVF cmake-2.8.10.2.tar.gz

cdcmake-2.8.10.2

./bootstrap

make&& make Install

Second, install MySQL

Groupaddmysql
useradd-g MySQL MySQL
cmake.-dcmake_install_prefix=/usr/local/mysql5/

-dmysql_datadir=/data/mysql-dwith_innobase_storage_engine=1

-dmysql_tcp_port=3306-dmysql_unix_addr=/var/run/mysql/mysql.sock

-dwith_debug=0
Make-j 2 && make install

Error Handling:

compiling mysql appears CMake errorat cmake/readlinenanake:83 (MESSAGE)

the reason for this error is that Ncurses-devel is not installed , run the following command

First step: Install

#yum-y Install Ncurses-devel

Step Two: Delete CMakeCache.txt

Find the location of all the CMakeCache.txt documents by using the Find command

#find/-name CMakeCache.txt

then delete all:

#rm-rf/usr/local/src/cmake-2.8.6/tests/complex/cache/cmakecache.txt

#rm-rf/usr/local/src/cmake-2.8.6/tests/complexoneconfig/cache/cmakecache.txt

#rm-rf/usr/local/src/cmake-2.8.6/tests/complexrelativepaths/cache/cmakecache.txt

#rm-rf/usr/local/src/mysql-5.5.18/cmakecache.txt

.........

Delete all and then re - cmake on the OK.

Third, the configuration Mysql

copy a my-medium.cnf from support-files to /etc/my.cnf, empty the default configuration inside, add the following configuration:

# Mysqld_multi will read the short contents of this configuration
[Mysqld_multi]
Mysqld =/usr/local/mysql5/bin/mysqld
Mysqladmin =/usr/local/mysql5/bin/mysqladmin

# First MYSQLD instance
[Mysqld1]
Port = 3306
Socket =/var/run/mysql/mysql1.sock
DataDir =/DATA/MYSQL1
General-log-file =/var/log/mysql/error.log
skip-external-locking
key_buffer_size = 16M
Max_allowed_ Packet = 1M
Table_open_cache =
Sort_buffer_size = 512K
Net_buffer_length = 8 k
Read_buffer_size = 256K
Read_rnd_buffer_size = 512K
Myisam_sort_buffer_size = 8M
Log-bin=mysql-bin
binlog_format=mixed
server-id       = 1
user = MySQL

# A second mysqld instance
[Mysqld2]
Port = 3307
Socket =/var/run/mysql/mysql2.sock
DataDir =/data/mysql2
General-log-file =/var/log/mysql/error.log
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
Log-bin=mysql-bin
Binlog_format=mixed
Server-id = 1
user = MySQL

# A third mysqld instance
[MYSQLD3]
Port = 3308

Socket =/var/run/mysql/mysql3.sock
DataDir =/data/mysql3
General-log-file =/var/log/mysql/error.log
skip-external-locking
Key_buffer_size = 16M
Max_allowed_packet = 1M
Table_open_cache = up
Sort_buffer_ Size = 512K
Net_buffer_length = 8 k
Read_buffer_size = 256K
Read_rnd_buffer_size = 512K
Myisam_sort_buffer_ Size = 8M
Log-bin=mysql-bin
binlog_format=mixed
server-id       = 1
User = MySQL

# Fourth instance of Mysqld
[Mysqld4]
Port = 3309
Socket =/var/run/mysql/mysql4.sock
DataDir =/data/mysql4
General-log-file =/var/log/mysql/error.log
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
Log-bin=mysql-bin
Binlog_format=mixed
Server-id = 1
user = MySQL

Mkdir-p/data/mysql1/data/mysql2/data/mysql3/data/mysql4/var/log/mysql/var/run/mysql

Chgrp mysql/data/mysql*/var/log/mysql/var/run/mysql

Chown mysql/data/mysql*/var/log/mysql/var/run/mysql

/usr/local/mysql5/scripts/mysql_install_db---datadir=/data/mysql1--user=mysql--basedir=/usr/local/mysql5

/usr/local/mysql5/scripts/mysql_install_db---datadir=/data/mysql2--user=mysql--basedir=/usr/local/mysql5

/usr/local/mysql5/scripts/mysql_install_db---datadir=/data/mysql3--user=mysql--basedir=/usr/local/mysql5

/usr/local/mysql5/scripts/mysql_install_db---datadir=/data/mysql4--user=mysql--basedir=/usr/local/mysql5

Vi/etc/profile

Add export path=/usr/local/mysql5/bin: $PATH field

Source/etc/profile

Mysqld_multi Start 1-4

Enter an instance of the database:

Mysql-s/var/run/mysql/mysql1.sock


For more technical documentation, please add Linux system Operations Communication Group: 260431835 regular weekly knowledge of Linux systems


This article is from the "Linux system operation and Maintenance Technology" blog, please be sure to keep this source http://fxlinux.blog.51cto.com/4926551/1874262

MySQL multi-instance configuration document

Related Article

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.