MySQL 多实例安装

Mysql 多实例安装

测试环境:
OS:CentOS 6.5(开发包全部安装)
Mysql:5.6.28
安装mysql两个实例,3306、3303端口

1:创建用户、相关目录
[root@mysql3 opt]# mkdir -p /mysql3306/data
[root@mysql3 opt]# mkdir -p /mysql3306/logs
[root@mysql3 opt]# mkdir -p /mysql3306/temp

[root@mysql3 opt]# mkdir -p /mysql3307/data
[root@mysql3 opt]# mkdir -p /mysql3307/logs
[root@mysql3 opt]# mkdir -p /mysql3307/temp

[root@mysql3 opt]# groupadd mysql
[root@mysql3 opt]# useradd -g mysql mysql

[root@mysql3 opt]# chown -R mysql:mysql /mysql3306/*
[root@mysql3 opt]# chown -R mysql:mysql /mysql3307/*

2:下载、解压、安装Mysql
[root@mysql3 local]# cd /opt
[root@mysql3 opt]# tar -zxvf mysql-5.6.28-linux-glibc2.5-x86_64.tar.gz
[root@mysql3 opt]# mv mysql-5.6.28-linux-glibc2.5-x86_64 /usr/local/

[root@mysql3 opt]# cd /usr/local/
[root@mysql3 local]# ln -s mysql-5.6.28-linux-glibc2.5-x86_64 mysql
[root@mysql3 local]# chown -R mysql:mysql /usr/local/mysql

3:编辑参数文件
[root@mysql3 opt]# vi /etc/mysql3306.cnf
[mysqld]
# GENERAL #
user = mysql
port = 3306
socket = /tmp/my3306.sock
pid_file = /mysql3306/temp/mysql3306.pid
datadir = /mysql3306/data
tmpdir = /mysql3306/temp
log_bin = /mysql3306/logs/mysql3306-bin
relay-log = /mysql3306/logs/mysql3306-relay-bin
log_error = /mysql3306/logs/error.log
slow_query_log_file = /mysql3306/logs/slow-queries.log
long_query_time=1
sync_binlog = 0
expire_logs_days = 7
back_log=1024
skip-name-resolve
skip-slave-start
skip-external-locking
skip-character-set-client-handshake
explicit_defaults_for_timestamp=true
default_storage_engine = InnoDB
bind-address=0.0.0.0
#lower_case_table_names  = 0
myisam_recover = FORCE,BACKUP
transaction-isolation = READ-COMMITTED
table_definition_cache = 4096
table_open_cache = 4096

# connection #
max_connections = 1100
max_user_connections = 1000
max_connect_errors = 1000

# timeout #
wait_timeout = 100
interactive_timeout = 100
lock_wait_timeout = 3
connect_timeout = 20
slave-net-timeout = 30

# character # 
character-set-server=utf8
init-connect='SET NAMES utf8'

# disabled query cache #
query_cache_type = 0
query_cache_size = 0

# replication #
server_id=233306
gtid_mode=ON
enforce-gtid-consistency
log-slave-updates
binlog-format=row
slave-parallel-workers=6
master-info-repository=TABLE
relay-log-info-repository=TABLE
sync_master_info = 10000
slave_sql_verify_checksum=1
skip-slave-start

# session #
key_buffer_size = 128M
tmp_table_size = 32M
max_heap_table_size = 32M
max_allowed_packet = 32M
bulk_insert_buffer_size = 32M
sort_buffer_size = 128K
read_buffer_size = 1M
read_rnd_buffer_size = 1M
join_buffer_size = 128K
myisam_sort_buffer_size = 32M
tmp_table_size = 32M
max_heap_table_size = 64M
thread_cache_size = 64
#thread_concurrency = 32
thread_stack = 192K

# INNODB #
innodb_flush_method = O_DIRECT
innodb_data_home_dir = /mysql3306/data
innodb_data_file_path = ibdata1:1024M:autoextend
#redo log
innodb_log_group_home_dir=/mysql3306/logs
innodb_log_files_in_group = 3
innodb_log_file_size = 1G
#innodb performance
innodb_flush_log_at_trx_commit = 0
innodb_file_per_table = 1
innodb_buffer_pool_instances = 8
innodb_io_capacity = 2000
innodb_lock_wait_timeout = 30
binlog_error_action = ABORT_SERVER
innodb_buffer_pool_size = 512M
innodb_max_dirty_pages_pct=90
innodb_file_format=Barracuda 
innodb_support_xa = 0
innodb_buffer_pool_dump_at_shutdown = 1
innodb_buffer_pool_load_at_startup = 1

[root@mysql3 opt]# cp /etc/mysql3306.cnf /etc/mysql3307.cnf
[root@mysql3 opt]# vi /etc/mysql3307.cnf 

[mysqld]
# GENERAL #
user = mysql
port = 3307
socket = /tmp/my3307.sock
pid_file = /mysql3307/temp/mysql3307.pid
datadir = /mysql3307/data
tmpdir = /mysql3307/temp
log_bin = /mysql3307/logs/mysql3307-bin
relay-log = /mysql3307/logs/mysql3307-relay-bin
log_error = /mysql3307/logs/error.log
slow_query_log_file = /mysql3307/logs/slow-queries.log
long_query_time=1
sync_binlog = 0
expire_logs_days = 7
back_log=1024
skip-name-resolve
skip-slave-start
skip-external-locking
skip-character-set-client-handshake
explicit_defaults_for_timestamp=true
default_storage_engine = InnoDB
bind-address=0.0.0.0
#lower_case_table_names  = 0
myisam_recover = FORCE,BACKUP
transaction-isolation = READ-COMMITTED
table_definition_cache = 4096
table_open_cache = 4096

# connection #
max_connections = 1100
max_user_connections = 1000
max_connect_errors = 1000

# timeout #
wait_timeout = 100
interactive_timeout = 100
lock_wait_timeout = 3
connect_timeout = 20
slave-net-timeout = 30

# character #
character-set-server=utf8
init-connect='SET NAMES utf8'

# disabled query cache #
query_cache_type = 0
query_cache_size = 0

# replication #
server_id=233307
gtid_mode=ON
enforce-gtid-consistency
log-slave-updates
binlog-format=row
slave-parallel-workers=6
master-info-repository=TABLE
relay-log-info-repository=TABLE
sync_master_info = 10000
slave_sql_verify_checksum=1
skip-slave-start

# session #
key_buffer_size = 128M
tmp_table_size = 32M
max_heap_table_size = 32M
max_allowed_packet = 32M
bulk_insert_buffer_size = 32M
sort_buffer_size = 128K
read_buffer_size = 1M
read_rnd_buffer_size = 1M
join_buffer_size = 128K
myisam_sort_buffer_size = 32M
tmp_table_size = 32M
max_heap_table_size = 64M
thread_cache_size = 64
#thread_concurrency = 32
thread_stack = 192K

# INNODB #
innodb_flush_method = O_DIRECT
innodb_data_home_dir = /mysql3307/data
innodb_data_file_path = ibdata1:1024M:autoextend
#redo log
innodb_log_group_home_dir=/mysql3307/logs
innodb_log_files_in_group = 3
innodb_log_file_size = 1G
#innodb performance
innodb_flush_log_at_trx_commit = 0
innodb_file_per_table = 1
innodb_buffer_pool_instances = 8
innodb_io_capacity = 2000
innodb_lock_wait_timeout = 30
binlog_error_action = ABORT_SERVER
innodb_buffer_pool_size = 512M
innodb_max_dirty_pages_pct=90
innodb_file_format=Barracuda
innodb_support_xa = 0
innodb_buffer_pool_dump_at_shutdown = 1
innodb_buffer_pool_load_at_startup = 1

4:初始化
初始化3306端口实例:
[root@mysql3 scripts]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --defaults-file=/etc/mysql3306.cnf
Installing MySQL system tables...2016-07-18 02:00:53 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.28-log) starting as process 2243 ...
OK
Filling help tables...2016-07-18 02:01:15 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.28-log) starting as process 2282 ...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
  /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql/bin/mysqladmin -u root -h 192.168.1.23 password 'new-password'
  ......
看见两个OK,就是正常完成初始化

初始化3307端口实例:
[root@mysql3 scripts]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --defaults-file=/etc/mysql3307.cnf
Installing MySQL system tables...2016-07-18 02:02:59 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.28-log) starting as process 2313 ...
OK
Filling help tables...2016-07-18 02:03:19 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.28-log) starting as process 2335 ...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
  /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql/bin/mysqladmin -u root -h 192.168.1.23 password 'new-password'
......
看见两个OK,就是正常完成初始化

5:启动
启动3306端口实例
[root@mysql3 scripts]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/mysql3306.cnf &
[1] 2366
[root@mysql3 scripts]# 160718 02:08:32 mysqld_safe Logging to '/mysql3306/logs/error.log'.
160718 02:08:32 mysqld_safe Starting mysqld daemon with databases from /mysql3306/data

[root@mysql3 scripts]#


查看error.log:
[root@mysql3 logs]# tail -200f /mysql3306/logs/error.log 
2016-07-18 02:00:53 2243 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-07-18 02:00:53 2243 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-18 02:00:53 2243 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-18 02:00:53 2243 [Note] InnoDB: Memory barrier is not used
2016-07-18 02:00:53 2243 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-18 02:00:53 2243 [Note] InnoDB: Using Linux native AIO
2016-07-18 02:00:53 2243 [Note] InnoDB: Not using CPU crc32 instructions
2016-07-18 02:00:53 2243 [Note] InnoDB: Initializing buffer pool, size = 512.0M
2016-07-18 02:00:53 2243 [Note] InnoDB: Completed initialization of buffer pool
2016-07-18 02:00:53 2243 [Note] InnoDB: The first specified data file /mysql3306/data/ibdata1 did not exist: a new database to be created!
2016-07-18 02:00:53 2243 [Note] InnoDB: Setting file /mysql3306/data/ibdata1 size to 1024 MB
2016-07-18 02:00:53 2243 [Note] InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
2016-07-18 02:00:56 2243 [Note] InnoDB: Setting log file /mysql3306/logs/ib_logfile101 size to 1024 MB
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
2016-07-18 02:01:03 2243 [Note] InnoDB: Setting log file /mysql3306/logs/ib_logfile1 size to 1024 MB
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
2016-07-18 02:01:09 2243 [Note] InnoDB: Setting log file /mysql3306/logs/ib_logfile2 size to 1024 MB
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
2016-07-18 02:01:13 2243 [Note] InnoDB: Renaming log file /mysql3306/logs/ib_logfile101 to /mysql3306/logs/ib_logfile0
2016-07-18 02:01:13 2243 [Warning] InnoDB: New log files created, LSN=45782
2016-07-18 02:01:13 2243 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-07-18 02:01:13 2243 [Note] InnoDB: Doublewrite buffer created
2016-07-18 02:01:13 2243 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-18 02:01:13 2243 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-07-18 02:01:13 2243 [Note] InnoDB: Foreign key constraint system tables created
2016-07-18 02:01:13 2243 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-07-18 02:01:13 2243 [Note] InnoDB: Tablespace and datafile system tables created.
2016-07-18 02:01:13 2243 [Note] InnoDB: Waiting for purge to start
2016-07-18 02:01:13 2243 [Note] InnoDB: 5.6.28 started; log sequence number 0
2016-07-18 02:01:13 7fe12cf34700 InnoDB: Loading buffer pool(s) from /mysql3306/data/ib_buffer_pool
2016-07-18 02:01:13 7fe12cf34700 InnoDB: Cannot open '/mysql3306/data/ib_buffer_pool' for reading: No such file or directory
2016-07-18 02:01:13 2243 [Warning] Bootstrap mode disables GTIDs. Bootstrap mode should only be used by mysql_install_db which initializes the MySQL data directory and creates system tables.
2016-07-18 02:01:14 2243 [Note] Binlog end
2016-07-18 02:01:14 2243 [Note] InnoDB: FTS optimize thread exiting.
2016-07-18 02:01:14 2243 [Note] InnoDB: Starting shutdown...
2016-07-18 02:01:14 7fe12cf34700 InnoDB: Dumping buffer pool(s) to /mysql3306/data/ib_buffer_pool
2016-07-18 02:01:14 7fe12cf34700 InnoDB: Buffer pool(s) dump completed at 160718  2:01:14
2016-07-18 02:01:15 2243 [Note] InnoDB: Shutdown completed; log sequence number 1625810
2016-07-18 02:01:15 2282 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-07-18 02:01:15 2282 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-18 02:01:15 2282 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-18 02:01:15 2282 [Note] InnoDB: Memory barrier is not used
2016-07-18 02:01:15 2282 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-18 02:01:15 2282 [Note] InnoDB: Using Linux native AIO
2016-07-18 02:01:15 2282 [Note] InnoDB: Not using CPU crc32 instructions
2016-07-18 02:01:15 2282 [Note] InnoDB: Initializing buffer pool, size = 512.0M
2016-07-18 02:01:15 2282 [Note] InnoDB: Completed initialization of buffer pool
2016-07-18 02:01:16 2282 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-18 02:01:16 2282 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-18 02:01:16 2282 [Note] InnoDB: Waiting for purge to start
2016-07-18 02:01:16 2282 [Note] InnoDB: 5.6.28 started; log sequence number 1625810
2016-07-18 02:01:16 7f4a2d621700 InnoDB: Loading buffer pool(s) from /mysql3306/data/ib_buffer_pool
2016-07-18 02:01:16 2282 [Warning] Bootstrap mode disables GTIDs. Bootstrap mode should only be used by mysql_install_db which initializes the MySQL data directory and creates system tables.
2016-07-18 02:01:16 7f4a2d621700 InnoDB: Buffer pool(s) load completed at 160718  2:01:16
2016-07-18 02:01:16 2282 [Note] Binlog end
2016-07-18 02:01:16 2282 [Note] InnoDB: FTS optimize thread exiting.
2016-07-18 02:01:16 2282 [Note] InnoDB: Starting shutdown...
2016-07-18 02:01:16 7f4a2d621700 InnoDB: Dumping buffer pool(s) to /mysql3306/data/ib_buffer_pool
2016-07-18 02:01:16 7f4a2d621700 InnoDB: Buffer pool(s) dump completed at 160718  2:01:16
2016-07-18 02:01:18 2282 [Note] InnoDB: Shutdown completed; log sequence number 1625820
160718 02:08:32 mysqld_safe Starting mysqld daemon with databases from /mysql3306/data
2016-07-18 02:08:37 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.28-log) starting as process 3431 ...
2016-07-18 02:08:38 3431 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
2016-07-18 02:08:38 3431 [Note] Plugin 'FEDERATED' is disabled.
2016-07-18 02:08:38 3431 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-07-18 02:08:38 3431 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-18 02:08:38 3431 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-18 02:08:38 3431 [Note] InnoDB: Memory barrier is not used
2016-07-18 02:08:38 3431 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-18 02:08:38 3431 [Note] InnoDB: Using Linux native AIO
2016-07-18 02:08:38 3431 [Note] InnoDB: Not using CPU crc32 instructions
2016-07-18 02:08:38 3431 [Note] InnoDB: Initializing buffer pool, size = 512.0M
2016-07-18 02:08:38 3431 [Note] InnoDB: Completed initialization of buffer pool
2016-07-18 02:08:38 3431 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-18 02:08:38 3431 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-18 02:08:38 3431 [Note] InnoDB: Waiting for purge to start
2016-07-18 02:08:38 3431 [Note] InnoDB: 5.6.28 started; log sequence number 1625820
2016-07-18 02:08:38 7fc7c4dfa700 InnoDB: Loading buffer pool(s) from /mysql3306/data/ib_buffer_pool
2016-07-18 02:08:38 3431 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 7c77185a-4c49-11e6-8450-000c29c7b3d5.
2016-07-18 02:08:38 7fc7c4dfa700 InnoDB: Buffer pool(s) load completed at 160718  2:08:38
2016-07-18 02:08:38 3431 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
2016-07-18 02:08:38 3431 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
2016-07-18 02:08:38 3431 [Note] Server socket created on IP: '0.0.0.0'.
2016-07-18 02:08:38 3431 [Warning] 'user' entry 'root@mysql3' ignored in --skip-name-resolve mode.
2016-07-18 02:08:38 3431 [Warning] 'user' entry '@mysql3' ignored in --skip-name-resolve mode.
2016-07-18 02:08:38 3431 [Warning] 'proxies_priv' entry '@ root@mysql3' ignored in --skip-name-resolve mode.
2016-07-18 02:08:38 3431 [Note] Event Scheduler: Loaded 0 events
2016-07-18 02:08:38 3431 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.6.28-log'  socket: '/tmp/my3306.sock'  port: 3306  MySQL Community Server (GPL)

启动3307端口实例
[root@mysql3 scripts]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/mysql3307.cnf &
[2] 3464
[root@mysql3 scripts]# 160718 02:11:50 mysqld_safe Logging to '/mysql3307/logs/error.log'.
160718 02:11:50 mysqld_safe Starting mysqld daemon with databases from /mysql3307/data

[root@mysql3 logs]# tail -200f /mysql3307/logs/error.log 
2016-07-18 02:02:59 2313 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-07-18 02:02:59 2313 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-18 02:02:59 2313 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-18 02:02:59 2313 [Note] InnoDB: Memory barrier is not used
2016-07-18 02:02:59 2313 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-18 02:02:59 2313 [Note] InnoDB: Using Linux native AIO
2016-07-18 02:02:59 2313 [Note] InnoDB: Not using CPU crc32 instructions
2016-07-18 02:02:59 2313 [Note] InnoDB: Initializing buffer pool, size = 512.0M
2016-07-18 02:02:59 2313 [Note] InnoDB: Completed initialization of buffer pool
2016-07-18 02:02:59 2313 [Note] InnoDB: The first specified data file /mysql3307/data/ibdata1 did not exist: a new database to be created!
2016-07-18 02:02:59 2313 [Note] InnoDB: Setting file /mysql3307/data/ibdata1 size to 1024 MB
2016-07-18 02:02:59 2313 [Note] InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
2016-07-18 02:03:02 2313 [Note] InnoDB: Setting log file /mysql3307/logs/ib_logfile101 size to 1024 MB
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
2016-07-18 02:03:07 2313 [Note] InnoDB: Setting log file /mysql3307/logs/ib_logfile1 size to 1024 MB
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
2016-07-18 02:03:12 2313 [Note] InnoDB: Setting log file /mysql3307/logs/ib_logfile2 size to 1024 MB
InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000
2016-07-18 02:03:17 2313 [Note] InnoDB: Renaming log file /mysql3307/logs/ib_logfile101 to /mysql3307/logs/ib_logfile0
2016-07-18 02:03:17 2313 [Warning] InnoDB: New log files created, LSN=45782
2016-07-18 02:03:17 2313 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-07-18 02:03:17 2313 [Note] InnoDB: Doublewrite buffer created
2016-07-18 02:03:17 2313 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-18 02:03:17 2313 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-07-18 02:03:17 2313 [Note] InnoDB: Foreign key constraint system tables created
2016-07-18 02:03:17 2313 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-07-18 02:03:17 2313 [Note] InnoDB: Tablespace and datafile system tables created.
2016-07-18 02:03:17 2313 [Note] InnoDB: Waiting for purge to start
2016-07-18 02:03:17 2313 [Note] InnoDB: 5.6.28 started; log sequence number 0
2016-07-18 02:03:17 7f040bb4c700 InnoDB: Loading buffer pool(s) from /mysql3307/data/ib_buffer_pool
2016-07-18 02:03:17 7f040bb4c700 InnoDB: Cannot open '/mysql3307/data/ib_buffer_pool' for reading: No such file or directory
2016-07-18 02:03:17 2313 [Warning] Bootstrap mode disables GTIDs. Bootstrap mode should only be used by mysql_install_db which initializes the MySQL data directory and creates system tables.
2016-07-18 02:03:18 2313 [Note] Binlog end
2016-07-18 02:03:18 2313 [Note] InnoDB: FTS optimize thread exiting.
2016-07-18 02:03:18 2313 [Note] InnoDB: Starting shutdown...
2016-07-18 02:03:18 7f040bb4c700 InnoDB: Dumping buffer pool(s) to /mysql3307/data/ib_buffer_pool
2016-07-18 02:03:18 7f040bb4c700 InnoDB: Buffer pool(s) dump completed at 160718  2:03:18
2016-07-18 02:03:19 2313 [Note] InnoDB: Shutdown completed; log sequence number 1625810
2016-07-18 02:03:19 2335 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-07-18 02:03:19 2335 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-18 02:03:19 2335 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-18 02:03:19 2335 [Note] InnoDB: Memory barrier is not used
2016-07-18 02:03:19 2335 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-18 02:03:19 2335 [Note] InnoDB: Using Linux native AIO
2016-07-18 02:03:19 2335 [Note] InnoDB: Not using CPU crc32 instructions
2016-07-18 02:03:19 2335 [Note] InnoDB: Initializing buffer pool, size = 512.0M
2016-07-18 02:03:19 2335 [Note] InnoDB: Completed initialization of buffer pool
2016-07-18 02:03:19 2335 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-18 02:03:19 2335 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-18 02:03:19 2335 [Note] InnoDB: Waiting for purge to start
2016-07-18 02:03:19 2335 [Note] InnoDB: 5.6.28 started; log sequence number 1625810
2016-07-18 02:03:19 7f8cd97fb700 InnoDB: Loading buffer pool(s) from /mysql3307/data/ib_buffer_pool
2016-07-18 02:03:19 2335 [Warning] Bootstrap mode disables GTIDs. Bootstrap mode should only be used by mysql_install_db which initializes the MySQL data directory and creates system tables.
2016-07-18 02:03:19 7f8cd97fb700 InnoDB: Buffer pool(s) load completed at 160718  2:03:19
2016-07-18 02:03:20 2335 [Note] Binlog end
2016-07-18 02:03:20 2335 [Note] InnoDB: FTS optimize thread exiting.
2016-07-18 02:03:20 2335 [Note] InnoDB: Starting shutdown...
2016-07-18 02:03:20 7f8cd97fb700 InnoDB: Dumping buffer pool(s) to /mysql3307/data/ib_buffer_pool
2016-07-18 02:03:20 7f8cd97fb700 InnoDB: Buffer pool(s) dump completed at 160718  2:03:20
2016-07-18 02:03:21 2335 [Note] InnoDB: Shutdown completed; log sequence number 1625820
160718 02:11:50 mysqld_safe Starting mysqld daemon with databases from /mysql3307/data
2016-07-18 02:11:54 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.28-log) starting as process 4517 ...
2016-07-18 02:11:54 4517 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
2016-07-18 02:11:54 4517 [Note] Plugin 'FEDERATED' is disabled.
2016-07-18 02:11:54 4517 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-07-18 02:11:54 4517 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-18 02:11:54 4517 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-18 02:11:54 4517 [Note] InnoDB: Memory barrier is not used
2016-07-18 02:11:54 4517 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-18 02:11:54 4517 [Note] InnoDB: Using Linux native AIO
2016-07-18 02:11:54 4517 [Note] InnoDB: Not using CPU crc32 instructions
2016-07-18 02:11:54 4517 [Note] InnoDB: Initializing buffer pool, size = 512.0M
2016-07-18 02:11:54 4517 [Note] InnoDB: Completed initialization of buffer pool
2016-07-18 02:11:54 4517 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-18 02:11:54 4517 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-18 02:11:54 4517 [Note] InnoDB: Waiting for purge to start
2016-07-18 02:11:54 4517 [Note] InnoDB: 5.6.28 started; log sequence number 1625820
2016-07-18 02:11:54 7f48e19d2700 InnoDB: Loading buffer pool(s) from /mysql3307/data/ib_buffer_pool
2016-07-18 02:11:54 7f48e19d2700 InnoDB: Buffer pool(s) load completed at 160718  2:11:54
2016-07-18 02:11:54 4517 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: f185c404-4c49-11e6-8453-000c29c7b3d5.
2016-07-18 02:11:54 4517 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3307
2016-07-18 02:11:54 4517 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
2016-07-18 02:11:54 4517 [Note] Server socket created on IP: '0.0.0.0'.
2016-07-18 02:11:54 4517 [Warning] 'user' entry 'root@mysql3' ignored in --skip-name-resolve mode.
2016-07-18 02:11:54 4517 [Warning] 'user' entry '@mysql3' ignored in --skip-name-resolve mode.
2016-07-18 02:11:54 4517 [Warning] 'proxies_priv' entry '@ root@mysql3' ignored in --skip-name-resolve mode.
2016-07-18 02:11:54 4517 [Note] Event Scheduler: Loaded 0 events
2016-07-18 02:11:54 4517 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.6.28-log'  socket: '/tmp/my3307.sock'  port: 3307  MySQL Community Server (GPL)


[root@mysql3 scripts]# ps -ef|grep mysql
root      2366  1774  0 02:08 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/mysql3306.cnf
mysql     3431  2366  1 02:08 pts/0    00:00:06 /usr/local/mysql/bin/mysqld --defaults-file=/etc/mysql3306.cnf --basedir=/usr/local/mysql --datadir=/mysql3306/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/mysql3306/logs/error.log --pid-file=/mysql3306/temp/mysql3306.pid --socket=/tmp/my3306.sock --port=3306
root      3464  1774  0 02:11 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/mysql3307.cnf
mysql     4517  3464  2 02:11 pts/0    00:00:04 /usr/local/mysql/bin/mysqld --defaults-file=/etc/mysql3307.cnf --basedir=/usr/local/mysql --datadir=/mysql3307/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/mysql3307/logs/error.log --pid-file=/mysql3307/temp/mysql3307.pid --socket=/tmp/my3307.sock --port=3307

6:连接测试
连接3306端口实例:
[root@mysql3 scripts]# /usr/local/mysql/bin/mysql -S /tmp/my3306.sock 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.28-log MySQL Community Server (GPL)

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

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql>


[root@mysql3 scripts]# /usr/local/mysql/bin/mysql -S /tmp/my3307.sock 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.28-log MySQL Community Server (GPL)

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

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

MySQL


From http://blog.csdn.net/zhanglei_16/article/details/51955081

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Linux系统下,可以通过多个实例来运行多个MySQL服务器,每个实例可以拥有独立的配置文件、数据目录和日志文件等。这样可以方便地管理多个不同的MySQL实例,提高系统的可靠性和稳定性。下面简单介绍一下在Linux下MySQL实例安装的过程。 1. 安装MySQL 首先需要安装MySQL,可以通过命令行或者图形界面进行安装。以Ubuntu系统为例,可以使用以下命令进行安装: ``` sudo apt-get update sudo apt-get install mysql-server ``` 2. 创建新的MySQL实例目录 在Linux系统下,每个MySQL实例需要有独立的数据目录和日志文件等。可以使用以下命令创建一个新的MySQL实例目录: ``` sudo mkdir /var/lib/mysql2 ``` 3. 复制MySQL配置文件 每个MySQL实例需要有独立的配置文件,可以通过复制默认配置文件来创建新的配置文件。以Ubuntu系统为例,可以使用以下命令复制默认配置文件: ``` sudo cp /etc/mysql/my.cnf /etc/mysql/my2.cnf ``` 4. 修改新的配置文件 修改新的配置文件,使其指向新的数据目录和日志文件等。以Ubuntu系统为例,可以使用以下命令编辑新的配置文件: ``` sudo vi /etc/mysql/my2.cnf ``` 在文件中修改以下内容: ``` [client] port = 3307 socket = /var/run/mysqld/mysqld2.sock [mysqld_safe] pid-file = /var/run/mysqld/mysqld2.pid socket = /var/run/mysqld/mysqld2.sock [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld2.pid socket = /var/run/mysqld/mysqld2.sock port = 3307 basedir = /usr datadir = /var/lib/mysql2 tmpdir = /tmp log_error = /var/log/mysql/error2.log ``` 其中,需要修改的内容主要是端口号、数据目录、日志文件等。 5. 初始化新的MySQL实例 使用以下命令初始化新的MySQL实例: ``` sudo mysqld --defaults-file=/etc/mysql/my2.cnf --initialize-insecure --user=mysql ``` 其中,--defaults-file参数指定使用新的配置文件,--initialize-insecure参数表示不设置root密码,--user参数表示启动MySQL进程的用户。 6. 启动新的MySQL实例 使用以下命令启动新的MySQL实例: ``` sudo systemctl start mysql@2.service ``` 其中,2表示新的MySQL实例的编号。 至此,多实例MySQL服务器已经成功安装。可以通过以下命令查看多个MySQL实例的状态: ``` sudo systemctl status mysql@*.service ``` 其中,*表示所有的MySQL实例
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值