Mysql 5.6 multi instances configuration on redhat 6.2

lovehewenyu發表於2016-06-23

Mysql 5.6 multi instances configuration on redhat 6.2

1.create mysql user
/usr/sbin/groupadd  -g 601 mysql
/usr/sbin/useradd -u 701 -g mysql mysql

2.create data directory and permissions and attributes
mkdir -p /mysql/data/3307/{data,binlog,tmp}
mkdir -p /mysql/data/3308/{data,binlog,tmp}
mkdir -p /mysql/data/3309/{data,binlog,tmp}
chmod 755 /mysql/data/
chown -R mysql:mysql /mysql/data/

[root@dbdou01 ~]# ls -l /mysql/data/
total 12
drwxr-xr-x. 5 mysql mysql 4096 Jun 23 10:48 3307
drwxr-xr-x. 5 mysql mysql 4096 Jun 23 10:48 3308
drwxr-xr-x. 5 mysql mysql 4096 Jun 23 10:48 3309


3.create {3307,3308,3309} my.cnf
vi /mysql/data/3307/my.cnf

點選( 此處 )摺疊或開啟

  1. [ client ]
  2. #password = mysql123
  3. port = 3307
  4. socket = / mysql / data / 3307 / mysql . sock
  5. default - character - set = utf8
  6. # Here follows entries for some specific programs

  7. # The MySQL server
  8. [ mysqld ]
  9. ignore - db - dir = lost + found
  10. federated
  11. character - set - server = utf8
  12. collation - server = utf8_bin
  13. port = 3307
  14. socket = / mysql / data / 3307 / mysql . sock
  15. datadir = / mysql / data / 3307
  16. skip - external - locking
  17. lower - case - table - names = 1
  18. #MYISAM
  19. max_connections = 2048
  20. key_buffer_size = 512M
  21. max_allowed_packet = 16M
  22. table_open_cache = 2048
  23. sort_buffer_size = 8M
  24. net_buffer_length = 512K
  25. read_buffer_size = 8M
  26. read_rnd_buffer_size = 16M
  27. myisam_sort_buffer_size = 256M
  28. query_cache_size = 64M
  29. join_buffer_size = 8M
  30. thread_concurrency = 24
  31. thread_cache_size = 8
  32. query_cache_size = 0
  33. query_cache_type = 0
  34. slow_query_log = 1
  35. long - query - time = 1
  36. transaction_isolation = REPEATABLE - READ
  37. bulk_insert_buffer_size = 64M
  38. myisam_max_sort_file_size = 10G
  39. skip - name - resolve
  40. event_scheduler = ON
  41. transaction - isolation = READ - COMMITTED
  42. log_bin_trust_function_creators = 1
  43. #skip - name - resolve

  44. # binary logging is required for replication
  45. log - bin = mysql - bin
  46. expire_logs_days = 1
  47. #binlog_format = ROW
  48. binlog_cache_size = 64M

  49. server - id = 3307

  50. innodb_data_home_dir = / mysql / data / 3307
  51. innodb_data_file_path = ibdata1 : 10M : autoextend
  52. innodb_log_group_home_dir = / mysql / data / 3307
  53. innodb_buffer_pool_size = 200m
  54. innodb_log_file_size = 500M
  55. innodb_log_buffer_size = 16M
  56. innodb_flush_log_at_trx_commit = 1
  57. innodb_lock_wait_timeout = 20
  58. innodb_io_capacity = 2000
  59. innodb_buffer_pool_instances = 3
  60. innodb_purge_threads = 1
  61. innodb_stats_on_metadata = off
  62. innodb_flush_method = O_DIRECT
  63. innodb_file_per_table = true
  64. innodb_print_all_deadlocks = 1

  65. [ mysqldump ]
  66. quick
  67. max_allowed_packet = 16M

  68. [ mysql ]
  69. no - auto - rehash
  70. # Remove the next comment character if you are not familiar with SQL
  71. #safe - updates

  72. [ myisamchk ]
  73. key_buffer_size = 20M
  74. sort_buffer_size = 20M
  75. read_buffer = 2M
  76. write_buffer = 2M
vi /mysql/data/3308/my.cnf

點選( 此處 )摺疊或開啟

  1. [ client ]
  2. #password = mysql123
  3. port = 3308
  4. socket = / mysql / data / 3308 / mysql . sock
  5. default - character - set = utf8
  6. # Here follows entries for some specific programs

  7. # The MySQL server
  8. [ mysqld ]
  9. ignore - db - dir = lost + found
  10. federated
  11. character - set - server = utf8
  12. collation - server = utf8_bin
  13. port = 3308
  14. socket = / mysql / data / 3308 / mysql . sock
  15. datadir = / mysql / data / 3308
  16. skip - external - locking
  17. lower - case - table - names = 1
  18. #MYISAM
  19. max_connections = 2048
  20. key_buffer_size = 512M
  21. max_allowed_packet = 16M
  22. table_open_cache = 2048
  23. sort_buffer_size = 8M
  24. net_buffer_length = 512K
  25. read_buffer_size = 8M
  26. read_rnd_buffer_size = 16M
  27. myisam_sort_buffer_size = 256M
  28. query_cache_size = 64M
  29. join_buffer_size = 8M
  30. thread_concurrency = 24
  31. thread_cache_size = 8
  32. query_cache_size = 0
  33. query_cache_type = 0
  34. slow_query_log = 1
  35. long - query - time = 1
  36. transaction_isolation = REPEATABLE - READ
  37. bulk_insert_buffer_size = 64M
  38. myisam_max_sort_file_size = 10G
  39. skip - name - resolve
  40. event_scheduler = ON
  41. transaction - isolation = READ - COMMITTED
  42. log_bin_trust_function_creators = 1
  43. #skip - name - resolve

  44. # binary logging is required for replication
  45. log - bin = mysql - bin
  46. expire_logs_days = 1
  47. #binlog_format = ROW
  48. binlog_cache_size = 64M

  49. server - id = 3308

  50. innodb_data_home_dir = / mysql / data / 3308
  51. innodb_data_file_path = ibdata1 : 10M : autoextend
  52. innodb_log_group_home_dir = / mysql / data / 3308
  53. innodb_buffer_pool_size = 200m
  54. innodb_log_file_size = 500M
  55. innodb_log_buffer_size = 16M
  56. innodb_flush_log_at_trx_commit = 1
  57. innodb_lock_wait_timeout = 20
  58. innodb_io_capacity = 2000
  59. innodb_buffer_pool_instances = 3
  60. innodb_purge_threads = 1
  61. innodb_stats_on_metadata = off
  62. innodb_flush_method = O_DIRECT
  63. innodb_file_per_table = true
  64. innodb_print_all_deadlocks = 1

  65. [ mysqldump ]
  66. quick
  67. max_allowed_packet = 16M

  68. [ mysql ]
  69. no - auto - rehash
  70. # Remove the next comment character if you are not familiar with SQL
  71. #safe - updates

  72. [ myisamchk ]
  73. key_buffer_size = 20M
  74. sort_buffer_size = 20M
  75. read_buffer = 2M
  76. write_buffer = 2M
vi /mysql/data/3309/my.cnf

點選( 此處 )摺疊或開啟

  1. [ client ]
  2. #password = mysql123
  3. port = 3309
  4. socket = / mysql / data / 3309 / mysql . sock
  5. default - character - set = utf8
  6. # Here follows entries for some specific programs

  7. # The MySQL server
  8. [ mysqld ]
  9. ignore - db - dir = lost + found
  10. federated
  11. character - set - server = utf8
  12. collation - server = utf8_bin
  13. port = 3309
  14. socket = / mysql / data / 3309 / mysql . sock
  15. datadir = / mysql / data / 3309
  16. skip - external - locking
  17. lower - case - table - names = 1
  18. #MYISAM
  19. max_connections = 2048
  20. key_buffer_size = 512M
  21. max_allowed_packet = 16M
  22. table_open_cache = 2048
  23. sort_buffer_size = 8M
  24. net_buffer_length = 512K
  25. read_buffer_size = 8M
  26. read_rnd_buffer_size = 16M
  27. myisam_sort_buffer_size = 256M
  28. query_cache_size = 64M
  29. join_buffer_size = 8M
  30. thread_concurrency = 24
  31. thread_cache_size = 8
  32. query_cache_size = 0
  33. query_cache_type = 0
  34. slow_query_log = 1
  35. long - query - time = 1
  36. transaction_isolation = REPEATABLE - READ
  37. bulk_insert_buffer_size = 64M
  38. myisam_max_sort_file_size = 10G
  39. skip - name - resolve
  40. event_scheduler = ON
  41. transaction - isolation = READ - COMMITTED
  42. log_bin_trust_function_creators = 1
  43. #skip - name - resolve

  44. # binary logging is required for replication
  45. log - bin = mysql - bin
  46. expire_logs_days = 1
  47. #binlog_format = ROW
  48. binlog_cache_size = 64M

  49. server - id = 3309

  50. innodb_data_home_dir = / mysql / data / 3309
  51. innodb_data_file_path = ibdata1 : 10M : autoextend
  52. innodb_log_group_home_dir = / mysql / data / 3309
  53. innodb_buffer_pool_size = 200m
  54. innodb_log_file_size = 500M
  55. innodb_log_buffer_size = 16M
  56. innodb_flush_log_at_trx_commit = 1
  57. innodb_lock_wait_timeout = 20
  58. innodb_io_capacity = 2000
  59. innodb_buffer_pool_instances = 3
  60. innodb_purge_threads = 1
  61. innodb_stats_on_metadata = off
  62. innodb_flush_method = O_DIRECT
  63. innodb_file_per_table = true
  64. innodb_print_all_deadlocks = 1

  65. [ mysqldump ]
  66. quick
  67. max_allowed_packet = 16M

  68. [ mysql ]
  69. no - auto - rehash
  70. # Remove the next comment character if you are not familiar with SQL
  71. #safe - updates

  72. [ myisamchk ]
  73. key_buffer_size = 20M
  74. sort_buffer_size = 20M
  75. read_buffer = 2M
  76. write_buffer = 2M

4.initialzation instance
/usr/bin/mysql_install_db --defaults-file=/mysql/data/3307/my.cnf --user=mysql --datadir=/mysql/data/3307
/usr/bin/mysql_install_db --defaults-file=/mysql/data/3308/my.cnf --user=mysql --datadir=/mysql/data/3308
/usr/bin/mysql_install_db --defaults-file=/mysql/data/3309/my.cnf --user=mysql --datadir=/mysql/data/3309


initialzation instance 3307 log

點選( 此處 )摺疊或開啟

  1. [ root@dbdou01 mysql ] # / usr / bin / mysql_install_db - - defaults - file = / mysql / data / 3307 / my . cnf - - user = mysql - - datadir = / mysql / data / 3307
  2. Installing MySQL system tables . . . 2016 - 06 - 23 11 : 17 : 11 0 [ Warning ] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release .
  3. 2016 - 06 - 23 11 : 17 : 11 0 [ Warning ] TIMESTAMP with implicit DEFAULT value is deprecated . Please use - - explicit_defaults_for_timestamp server option ( see documentation for more details ) .
  4. 2016 - 06 - 23 11 : 17 : 11 0 [ Note ] / usr / sbin / mysqld ( mysqld 5 . 6 . 29 - log ) starting as process 26999 . . .
  5. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Using atomics to ref count buffer pool pages
  6. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : The InnoDB memory heap is disabled
  7. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Mutexes and rw_locks use GCC atomic builtins
  8. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Memory barrier is not used
  9. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Compressed tables use zlib 1 . 2 . 3
  10. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Using Linux native AIO
  11. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Using CPU crc32 instructions
  12. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Initializing buffer pool , size = 200 . 0M
  13. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Completed initialization of buffer pool
  14. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : The first specified data file / mysql / data / 3307 / ibdata1 did not exist : a new database to be
  15. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Setting file / mysql / data / 3307 / ibdata1 size to 10 MB
  16. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Database physically writes the file full : wait . . .
  17. 2016 - 06 - 23 11 : 17 : 11 26999 [ Note ] InnoDB : Setting log file / mysql / data / 3307 / ib_logfile101 size to 500 MB
  18. InnoDB : Progress in MB : 100 200 300 400 500
  19. 2016 - 06 - 23 11 : 17 : 17 26999 [ Note ] InnoDB : Setting log file / mysql / data / 3307 / ib_logfile1 size to 500 MB
  20. InnoDB : Progress in MB : 100 200 300 400 500
  21. 2016 - 06 - 23 11 : 17 : 23 26999 [ Note ] InnoDB : Renaming log file / mysql / data / 3307 / ib_logfile101 to / mysql / data / 3307 / ib_logfile0
  22. 2016 - 06 - 23 11 : 17 : 23 26999 [ Warning ] InnoDB : New log files created , LSN = 45781
  23. 2016 - 06 - 23 11 : 17 : 23 26999 [ Note ] InnoDB : Doublewrite buffer not found : creating new
  24. 2016 - 06 - 23 11 : 17 : 23 26999 [ Note ] InnoDB : Doublewrite buffer created
  25. 2016 - 06 - 23 11 : 17 : 24 26999 [ Note ] InnoDB : 128 rollback segment ( s ) are active .
  26. 2016 - 06 - 23 11 : 17 : 24 26999 [ Warning ] InnoDB : Creating foreign key constraint system tables .
  27. 2016 - 06 - 23 11 : 17 : 24 26999 [ Note ] InnoDB : Foreign key constraint system tables created
  28. 2016 - 06 - 23 11 : 17 : 24 26999 [ Note ] InnoDB : Creating tablespace and datafile system tables .
  29. 2016 - 06 - 23 11 : 17 : 24 26999 [ Note ] InnoDB : Tablespace and datafile system tables created .
  30. 2016 - 06 - 23 11 : 17 : 24 26999 [ Note ] InnoDB : Waiting for purge to start
  31. 2016 - 06 - 23 11 : 17 : 24 26999 [ Note ] InnoDB : 5 . 6 . 29 started ; log sequence number 0
  32. 2016 - 06 - 23 11 : 17 : 25 26999 [ Note ] Binlog end
  33. 2016 - 06 - 23 11 : 17 : 25 26999 [ Note ] InnoDB : FTS optimize thread exiting .
  34. 2016 - 06 - 23 11 : 17 : 25 26999 [ Note ] InnoDB : Starting shutdown . . .
  35. 2016 - 06 - 23 11 : 17 : 26 26999 [ Note ] InnoDB : Shutdown completed ; log sequence number 1625984
  36. OK

  37. Filling help tables . . . 2016 - 06 - 23 11 : 17 : 26 0 [ Warning ] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release .
  38. 2016 - 06 - 23 11 : 17 : 26 0 [ Warning ] TIMESTAMP with implicit DEFAULT value is deprecated . Please use - - explicit_defaults_for_timestamp server option ( see documentation for more details ) .
  39. 2016 - 06 - 23 11 : 17 : 26 0 [ Note ] / usr / sbin / mysqld ( mysqld 5 . 6 . 29 - log ) starting as process 27022 . . .
  40. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Using atomics to ref count buffer pool pages
  41. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : The InnoDB memory heap is disabled
  42. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Mutexes and rw_locks use GCC atomic builtins
  43. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Memory barrier is not used
  44. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Compressed tables use zlib 1 . 2 . 3
  45. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Using Linux native AIO
  46. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Using CPU crc32 instructions
  47. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Initializing buffer pool , size = 200 . 0M
  48. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Completed initialization of buffer pool
  49. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Highest supported file format is Barracuda .
  50. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : 128 rollback segment ( s ) are active .
  51. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : Waiting for purge to start
  52. 2016 - 06 - 23 11 : 17 : 26 27022 [ Note ] InnoDB : 5 . 6 . 29 started ; log sequence number 1625984
  53. 2016 - 06 - 23 11 : 17 : 27 27022 [ Note ] Binlog end
  54. 2016 - 06 - 23 11 : 17 : 27 27022 [ Note ] InnoDB : FTS optimize thread exiting .
  55. 2016 - 06 - 23 11 : 17 : 27 27022 [ Note ] InnoDB : Starting shutdown . . .
  56. 2016 - 06 - 23 11 : 17 : 28 27022 [ Note ] InnoDB : Shutdown completed ; log sequence number 1625994
  57. OK

  58. To start mysqld at boot time you have to copy
  59. support - files / mysql . server to the right place for your system

  60. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
  61. To do so , start the server , then issue the following commands :

  62.    / usr / bin / mysqladmin - u root password 'new-password'
  63.    / usr / bin / mysqladmin - u root - h 10 . 124 . 110 . 113 password 'new-password'
  64. ## [ root@dbdou01 mysql ] # / usr / bin / mysqladmin - S / mysql / data / 3307 / mysql . sock - u root password 'mysql123!'
  65. ##Warning : Using a password on the command line interface can be insecure .

  66. Alternatively you can run :

  67.    / usr / bin / mysql_secure_installation

  68. which will also give you the option of removing the test
  69. databases and anonymous user created by default . This is
  70. strongly recommended for production servers .

  71. See the manual for more instructions .

  72. You can start the MySQL daemon with :

  73.   cd / usr ; / usr / bin / mysqld_safe &
  74. ##mysqld_safe - - defaults - file = / mysql / data / 3307 / my . cnf &

  75. You can test the MySQL daemon with mysql - test - run . pl

  76.   cd mysql - test ; perl mysql - test - run . pl

  77. Please report any problems at http : / / bugs . mysql . com /

  78. The latest information about MySQL is available on the web at

  79.   http : / / www . mysql . com

  80. Support MySQL by buying support / licenses at http : / / shop . mysql . com

  81. WARNING : Found existing config file / usr / my . cnf on the system .
  82. Because this file might be in use , it was not replaced ,
  83. but was used in bootstrap ( unless you used - - defaults - file )
  84. and when you later start the server .
  85. The new default config file was created as / usr / my - new . cnf ,
  86. please compare it with your file and take the changes you need .

mysqld_safe --defaults-file=/mysql/data/3308/my.cnf &
/usr/bin/mysqladmin -S /mysql/data/3308/mysql.sock -u root password 'mysql123!'
/usr/bin/mysqladmin -S /mysql/data/3308/mysql.sock -u root -pmysql123! shutdown

mysqld_safe --defaults-file=/mysql/data/3309/my.cnf &
/usr/bin/mysqladmin -S /mysql/data/3309/mysql.sock -u root password 'mysql123!'
/usr/bin/mysqladmin -S /mysql/data/3309/mysql.sock -u root -pmysql123! shutdown

5. mysqld_multi start mysql and create user admin manage mysqld start or stop

vi /etc/my.cnf

點選( 此處 )摺疊或開啟

  1. [ mysqld_multi ]
  2. mysqld = / usr / bin / mysqld_safe
  3. mysqladmin = / usr / bin / mysqladmin
  4. user = admin
  5. password = password

  6. [ mysqld3307 ]
  7. ignore - db - dir = lost + found
  8. federated
  9. character - set - server = utf8
  10. collation - server = utf8_bin
  11. port = 3307
  12. socket = / mysql / data / 3307 / mysql . sock
  13. datadir = / mysql / data / 3307
  14. skip - external - locking
  15. lower - case - table - names = 1
  16. #MYISAM
  17. max_connections = 2048
  18. key_buffer_size = 512M
  19. max_allowed_packet = 16M
  20. table_open_cache = 2048
  21. sort_buffer_size = 8M
  22. net_buffer_length = 512K
  23. read_buffer_size = 8M
  24. read_rnd_buffer_size = 16M
  25. myisam_sort_buffer_size = 256M
  26. query_cache_size = 64M
  27. join_buffer_size = 8M
  28. thread_concurrency = 24
  29. thread_cache_size = 8
  30. query_cache_size = 0
  31. query_cache_type = 0
  32. slow_query_log = 1
  33. long - query - time = 1
  34. transaction_isolation = REPEATABLE - READ
  35. bulk_insert_buffer_size = 64M
  36. myisam_max_sort_file_size = 10G
  37. skip - name - resolve
  38. event_scheduler = ON
  39. transaction - isolation = READ - COMMITTED
  40. log_bin_trust_function_creators = 1
  41. #skip - name - resolve

  42. # binary logging is required for replication
  43. log - bin = mysql - bin
  44. expire_logs_days = 1
  45. #binlog_format = ROW
  46. binlog_cache_size = 64M

  47. server - id = 3307

  48. innodb_data_home_dir = / mysql / data / 3307
  49. innodb_data_file_path = ibdata1 : 10M : autoextend
  50. innodb_log_group_home_dir = / mysql / data / 3307
  51. innodb_buffer_pool_size = 200m
  52. innodb_log_file_size = 500M
  53. innodb_log_buffer_size = 16M
  54. innodb_flush_log_at_trx_commit = 1
  55. innodb_lock_wait_timeout = 20
  56. innodb_io_capacity = 2000
  57. innodb_buffer_pool_instances = 3
  58. innodb_purge_threads = 1
  59. innodb_stats_on_metadata = off
  60. innodb_flush_method = O_DIRECT
  61. innodb_file_per_table = true
  62. innodb_print_all_deadlocks = 1

  63. [ mysqldump ]
  64. quick
  65. max_allowed_packet = 16M

  66. [ mysql ]
  67. no - auto - rehash
  68. # Remove the next comment character if you are not familiar with SQL
  69. #safe - updates

  70. [ myisamchk ]
  71. key_buffer_size = 20M
  72. sort_buffer_size = 20M
  73. read_buffer = 2M
  74. write_buffer = 2M


  75. [ mysqld3308 ]
  76. ignore - db - dir = lost + found
  77. federated
  78. character - set - server = utf8
  79. collation - server = utf8_bin
  80. port = 3308
  81. socket = / mysql / data / 3308 / mysql . sock
  82. datadir = / mysql / data / 3308
  83. skip - external - locking
  84. lower - case - table - names = 1
  85. #MYISAM
  86. max_connections = 2048
  87. key_buffer_size = 512M
  88. max_allowed_packet = 16M
  89. table_open_cache = 2048
  90. sort_buffer_size = 8M
  91. net_buffer_length = 512K
  92. read_buffer_size = 8M
  93. read_rnd_buffer_size = 16M
  94. myisam_sort_buffer_size = 256M
  95. query_cache_size = 64M
  96. join_buffer_size = 8M
  97. thread_concurrency = 24
  98. thread_cache_size = 8
  99. query_cache_size = 0
  100. query_cache_type = 0
  101. slow_query_log = 1
  102. long - query - time = 1
  103. transaction_isolation = REPEATABLE - READ
  104. bulk_insert_buffer_size = 64M
  105. myisam_max_sort_file_size = 10G
  106. skip - name - resolve
  107. event_scheduler = ON
  108. transaction - isolation = READ - COMMITTED
  109. log_bin_trust_function_creators = 1
  110. #skip - name - resolve

  111. # binary logging is required for replication
  112. log - bin = mysql - bin
  113. expire_logs_days = 1
  114. #binlog_format = ROW
  115. binlog_cache_size = 64M

  116. server - id = 3308

  117. innodb_data_home_dir = / mysql / data / 3308
  118. innodb_data_file_path = ibdata1 : 10M : autoextend
  119. innodb_log_group_home_dir = / mysql / data / 3308
  120. innodb_buffer_pool_size = 200m
  121. innodb_log_file_size = 500M
  122. innodb_log_buffer_size = 16M
  123. innodb_flush_log_at_trx_commit = 1
  124. innodb_lock_wait_timeout = 20
  125. innodb_io_capacity = 2000
  126. innodb_buffer_pool_instances = 3
  127. innodb_purge_threads = 1
  128. innodb_stats_on_metadata = off
  129. innodb_flush_method = O_DIRECT
  130. innodb_file_per_table = true
  131. innodb_print_all_deadlocks = 1

  132. [ mysqldump ]
  133. quick
  134. max_allowed_packet = 16M

  135. [ mysql ]
  136. no - auto - rehash
  137. # Remove the next comment character if you are not familiar with SQL
  138. #safe - updates

  139. [ myisamchk ]
  140. key_buffer_size = 20M
  141. sort_buffer_size = 20M
  142. read_buffer = 2M
  143. write_buffer = 2M


  144. [ mysqld3309 ]
  145. ignore - db - dir = lost + found
  146. federated
  147. character - set - server = utf8
  148. collation - server = utf8_bin
  149. port = 3309
  150. socket = / mysql / data / 3309 / mysql . sock
  151. datadir = / mysql / data / 3309
  152. skip - external - locking
  153. lower - case - table - names = 1
  154. #MYISAM
  155. max_connections = 2048
  156. key_buffer_size = 512M
  157. max_allowed_packet = 16M
  158. table_open_cache = 2048
  159. sort_buffer_size = 8M
  160. net_buffer_length = 512K
  161. read_buffer_size = 8M
  162. read_rnd_buffer_size = 16M
  163. myisam_sort_buffer_size = 256M
  164. query_cache_size = 64M
  165. join_buffer_size = 8M
  166. thread_concurrency = 24
  167. thread_cache_size = 8
  168. query_cache_size = 0
  169. query_cache_type = 0
  170. slow_query_log = 1
  171. long - query - time = 1
  172. transaction_isolation = REPEATABLE - READ
  173. bulk_insert_buffer_size = 64M
  174. myisam_max_sort_file_size = 10G
  175. skip - name - resolve
  176. event_scheduler = ON
  177. transaction - isolation = READ - COMMITTED
  178. log_bin_trust_function_creators = 1
  179. #skip - name - resolve

  180. # binary logging is required for replication
  181. log - bin = mysql - bin
  182. expire_logs_days = 1
  183. #binlog_format = ROW
  184. binlog_cache_size = 64M

  185. server - id = 3309

  186. innodb_data_home_dir = / mysql / data / 3309
  187. innodb_data_file_path = ibdata1 : 10M : autoextend
  188. innodb_log_group_home_dir = / mysql / data / 3309
  189. innodb_buffer_pool_size = 200m
  190. innodb_log_file_size = 500M
  191. innodb_log_buffer_size = 16M
  192. innodb_flush_log_at_trx_commit = 1
  193. innodb_lock_wait_timeout = 20
  194. innodb_io_capacity = 2000
  195. innodb_buffer_pool_instances = 3
  196. innodb_purge_threads = 1
  197. innodb_stats_on_metadata = off
  198. innodb_flush_method = O_DIRECT
  199. innodb_file_per_table = true
  200. innodb_print_all_deadlocks = 1

  201. [ mysqldump ]
  202. quick
  203. max_allowed_packet = 16M

  204. [ mysql ]
  205. no - auto - rehash
  206. # Remove the next comment character if you are not familiar with SQL
  207. #safe - updates

  208. [ myisamchk ]
  209. key_buffer_size = 20M
  210. sort_buffer_size = 20M
  211. read_buffer = 2M
  212. write_buffer = 2M

  213. [ mysqldump ]
  214. quick
  215. max_allowed_packet = 256M
  216. [ mysql ]
  217. no - auto - rehash
  218. prompt = \ \ u @ \ \ d \\R : \ \ m >
  219. [ myisamchk ]
  220. key_buffer_size = 512M
  221. sort_buffer_size = 512M
  222. read_buffer = 8M
  223. write_buffer = 8M
  224. [ mysqlhotcopy ]
  225. interactive - timeout
  226. [ mysqld_safe ]
  227. open - files - limit = 8192
##create user admin
[mysql@dbdou01 ~]$ mysql -uroot -pmysql123! -S /mysql/data/3307/mysql.sock
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.6.29-log MySQL Community Server (GPL)


Copyright (c) 2000, 2016, 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.

) 16:00>GRANT SHUTDOWN ON *.* TO IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

) 16:00>flush privileges;
Query OK, 0 rows affected (0.00 sec)

##mysqld_multi start
mysqld_multi start 3307-3309
## check mysql port
[root@dbdou01 ~]# netstat -ntlp  | grep mysql
tcp        0      0 :::3307                     :::*                        LISTEN      8935/mysqld        
tcp        0      0 :::3308                     :::*                        LISTEN      8941/mysqld        
tcp        0      0 :::3309                     :::*                        LISTEN      8934/mysqld

6.Boot from the start
vi /etc/init.d/mysql_boot.local
/usr/bin/mysqld_multi start 3307-3309


參考:

http://blog.chinaunix.net/uid-25760152-id-3472603.html
http://blog.csdn.net/leshami/article/details/40339167


########################################################################################
版權所有,文章允許轉載,但必須以連結方式註明源地址,否則追究法律責任!【QQ交流群:53993419】
QQ:14040928 E-mail:
本文連結: http://blog.itpub.net/26442936/viewspace-2120848/
########################################################################################


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26442936/viewspace-2120848/,如需轉載,請註明出處,否則將追究法律責任。

相關文章