Second, installation configuration MYSQL5.6 multi-instance-shared profile method

Source: Internet
Author: User

Second, installation configuration MYSQL5.6 Multi-instance - shared configuration file Methods

1, if you have already run a single instance of the database, please first stop the library

[Email protected] ~]# mysqladmin shutdown-u root-p

Enter Password:

2. Create data directory for each instance

[Email protected] ~]# mkdir/home/mysql/data3307

[Email protected] ~]# mkdir/home/mysql/data3308

3, modify the owner of each instance data directory

[Email protected] ~]# chown-r mysql.mysql/home/mysql/data3307

[Email protected] ~]# chown-r mysql.mysql/home/mysql/data3308

4. Verifying Data Catalog

[Email protected] ~]# cd/home/mysql/

[email protected] mysql]# LL

Total 12

Drwxr-xr-x 5 mysql mysql 4096 Nov 5 23:44 data

Drwxr-xr-x 2 mysql mysql 4096 Nov 5 23:58 data3307

Drwxr-xr-x 2 mysql mysql 4096 Nov 5 23:58 data3308

[Email protected] mysql]#

5. Modify The my.cnf master configuration file

[[email protected] MySQL] #cp/etc/my.cnf/etc/my.cnf.bak

[[email protected] MySQL] #vim/etc/my.cnf

[Mysqld]

#basedir =/usr/local/mysql

#datadir =/home/mysql/data

#socket =/usr/local/mysql/mysqld.sock

#port =3306

#server_id =100

user = MySQL

Join_buffer_size = 128M

Sort_buffer_size = 2M

Read_rnd_buffer_size = 2M

Default_storage_engine = InnoDB

Join_buffer_size = 128M

max_allowed_packet= 1M

Net_buffer_length= 8K

[Mysqld_multi]

Mysqld =/usr/local/mysql/bin/mysqld_safe

Mysqladmin=/usr/local/mysql/bin/mysqladmin

[mysqld3306]

Port =3306

Basedir =/usr/local/mysql

DataDir =/home/mysql/data

Socket =/home/mysql/data/mysqld.sock

server_id =1

[mysqld3307]

Port =3307

Basedir =/usr/local/mysql

DataDir =/home/mysql/data3307

Socket =/home/mysql/data3307/mysql.sock3307

server_id=2

[mysqld3308]

Port =3308

Basedir =/usr/local/mysql

DataDir =/home/mysql/data3308

Socket =/home/mysql/data3308/mysql.sock3308

Server_id=3

6. Initializing the database instance

[Email protected] mysql]#/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/home/ mysql/data3307--user=mysql

[Email protected] mysql]#/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/home/ mysql/data3308--user=mysql

7. Start the database

[Email protected] ~]# Ps-ef|grep Mysql|grep-vgrep

[[email protected] ~]# Mysqld_multi start 3306

[[email protected] ~]# Mysqld_multi start 3307

[[email protected] ~]# Mysqld_multi start 3308

8. Verifying the instance process

[Email protected] ~]# Ps-ef|grep Mysql|grep-vgrep

Root 60854 1 0 00:31 pts/0 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--port=3306--basedir=/usr/local/my Sql--datadir=/home/mysql/data--socket=/home/mysql/data/mysqld.sock--server_id=1

MySQL 61316 60854 0 00:31 pts/0 00:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/home/mysql /data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--server-id=1--log-error=/home/mysql/data/ mysql-error.log--open-files-limit=65535--pid-file=/home/mysql/data/mysql.pid--socket=/home/mysql/data/ Mysqld.sock--port=3306

Root 61348 1 0 00:31 pts/0 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--port=3307--basedir=/usr/local/my sql--datadir=/home/mysql/data3307--socket=/home/mysql/data3307/mysql.sock3307--server_id=2

MySQL 61810 61348 0 00:31 pts/0 00:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/home/mysql /data3307--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--server-id=2--log-error=/home/mysql/data/ mysql-error.log--open-files-limit=65535--pid-file=/home/mysql/data3307/mysql.pid--socket=/home/mysql/data3307/ mysql.sock3307--port=3307

Root 61841 1 0 00:31 pts/0 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--port=3308--basedir=/usr/local/my sql--datadir=/home/mysql/data3308--socket=/home/mysql/data3308/mysql.sock3308--server_id=3

MySQL 62303 61841 0 00:31 pts/0 00:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/home/mysql /data3308--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--server-id=3--log-error=/home/mysql/data/ Mysql-error.log--open-files-limit=65535--pid-file=/home/mysql/data3308/mysql.pid--socket=/home/mysql/data3308/ mysql.sock3308--port=3308

[Email protected] ~]#

9. Verify the Port

[Email protected] ~]# Netstat-tunlp|grep 330

TCP 0 0::: 3307:::* LISTEN 61810/mysqld

TCP 0 0::: 3308:::* LISTEN 62303/mysqld

TCP 0 0::: 3306:::* LISTEN 61316/mysqld

[Email protected] ~]# Ss-tunlp|grep 330

TCP LISTEN 0::: 3307:::* Users: (("mysqld", 61810,12))

TCP LISTEN 0::: 3308:::* Users: (("mysqld", 62303,12))

TCP LISTEN 0::: 3306:::* Users: (("mysqld", 61316,12))

[Email protected] ~]#

9, login 3306,3307,3308 instances

Mysql-uroot-p-s/home/mysql/data/mysqld.sock

mysql-s/home/mysql/data3307/mysql.sock3307

Mysql-s/home/mysql/data3307/mysql.sock3308

mysql> status;

8. Stop the database

[[email protected] ~]# Mysqld_multi stop 3306

[[email protected] ~]# Mysqld_multi stop 3307

[[email protected] ~]# Mysqld_multi stop 3308

[Email protected] ~]# Ps-ef|grep Mysql|grep-vgrep

Root 57734 1 0 00:23 pts/0 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--port=3306--basedir=/usr/local/my SQL--datadir=/home/mysql/data--socket=/usr/local/mysql/mysqld.sock--server_id=100

MySQL 58196 57734 0 00:23 pts/0 00:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/home/mysql /data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--server-id=100--log-error=/home/mysql/data/ mysql-error.log--open-files-limit=65535--pid-file=/home/mysql/data/mysql.pid--socket=/usr/local/mysql/ Mysqld.sock--port=3306

[Email protected] ~]#

We found 3306 The instance has not stopped, this is because 3306 database is configured with [email protected] the password is 123456 , you must use Root user and password to stop

[Email protected] ~]# Mysqld_multi stop 3306--user=root--password=123456

Note: 3307 , 3308 The instance does not have a password login, and the empty password account is not deleted, not secure, to configure password login and delete the empty password account


This article is from "David's operation and maintenance of private cuisine" blog, please be sure to keep this source http://dawei2015.blog.51cto.com/140637/1710078

Second, installation configuration MYSQL5.6 multi-instance-shared profile method

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.