MySQL multi-instance configuration file and startup file

Source: Internet
Author: User

-----------MySQL Multi-instance configuration file

[[Email protected]/]# cat/data/3307/my.cnf


[Client]

Port = 3307 #<== Port number

Socket =/data/3307/mysql.sock

[MySQL]

No-auto-rehash

[Mysqld]

user = MySQL #<== member

Port = 3307 #<== Port number

Socket =/data/3307/mysql.sock

Basedir =/application/mysql

DataDir =/data/3307/data

Open_files_limit = 1024

Back_log = 600

Max_connections = 800

Max_connect_errors = 3000

Table_cache = 614

external-locking = FALSE

Max_allowed_packet =8m

Sort_buffer_size = 1M

Join_buffer_size = 1M

thread_cache_size = 100

Thread_concurrency = 2

Query_cache_size = 2M

Query_cache_limit = 1M

Query_cache_min_res_unit = 2k

#default_table_type = InnoDB

Thread_stack = 192K

#transaction_isolation = read-committed

Tmp_table_size = 2M

Max_heap_table_size = 2M

#long_query_time = 1

#log_long_format

#log-error =/data/3307/error.log

#log-slow-queries =/data/3307/slow.log

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

#log-bin =/data/3307/mysql-bin

Relay-log =/data/3307/relay-bin

Relay-log-info-file =/data/3307/relay-log.info

Binlog_cache_size = 1M

Max_binlog_cache_size = 1M

Max_binlog_size = 2M

Expire_logs_days = 7

Key_buffer_size = 16M

Read_buffer_size = 1M

Read_rnd_buffer_size = 1M

Bulk_insert_buffer_size = 1M

#myisam_sort_buffer_size = 1M

#myisam_max_sort_file_size = 10G

#myisam_max_extra_sort_file_size = 10G

#myisam_repair_threads = 1

#myisam_recover

Lower_case_table_names = 1

Skip-name-resolve

Slave-skip-errors = 1032,1062

Replicate-ignore-db=mysql

Server-id = 3

Innodb_additional_mem_pool_size = 4M

Innodb_buffer_pool_size = 32M

Innodb_data_file_path =ibdata1:128m:autoextend

Innodb_file_io_threads = 4

Innodb_thread_concurrency = 8

Innodb_flush_log_at_trx_commit = 2

Innodb_log_buffer_size = 2M

Innodb_log_file_size = 4M

Innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 90

Innodb_lock_wait_timeout = 120

innodb_file_per_table = 0

[Mysqldump]

Quick

Max_allowed_packet = 2M

[Mysqld_safe]

Log-error=/data/3307/mysql_3307.err #<== log file

pid-file=/data/3307/mysqld.pid


--------------------------------------------------------------------------------------------------------------- ---------------------

-----------MySQL Multi-instance boot file

[[Email protected]/]# cat/data/3308/mysql

#!/bin/sh

################################################

#this scripts iscreated by Tudou at 2016-06-09

#tudou qq:1097857032 1+1=3

#blog: Http://blog.51cto.com/user_index.php?action=addblog_new

################################################

#init

port=3307

Mysql_user= "Root"

mysql_pwd= "123456" #<== set the password

Cmdpath= "/application/mysql/bin"

mysql_sock= "/data/${port}/mysql.sock" #<== into multi-instance database requires Mysql.sock

#startup function

Function_start_mysql ()

{

if [!-e "$mysql _sock"];then

printf "Starting mysql...\n"

/bin/sh ${cmdpath}/mysqld_safe--defaults-file=/data/${port}/my.cnf 2>&1 >/dev/null &

Else

printf "MySQL is running...\n"

Exit

Fi

}

#stop function

Function_stop_mysql ()

{

if [!-e "$mysql _sock"];then

printf "MySQL is stopped...\n"

Exit

Else

printf "stoping mysql...\n"

${cmdpath}/mysqladmin-u ${mysql_user}-p${mysql_pwd}-s/data/${port}/mysql.sock shutdown

Fi

}

#restart function

Function_restart_mysql ()

{

printf "Restarting mysql...\n"

Function_stop_mysql

Sleep 2

Function_start_mysql

}

Case $ in

Start

Function_start_mysql

;;

Stop

Function_stop_mysql

;;

Restart

Function_restart_mysql

;;

*)

printf "Usage:/data/${port}/mysql{start|stop|restart}\n"

Esac


######################################################################################


-----------the files generated after starting the MySQL database from the above configuration are as follows:

mysql-bin.000001 #<== MySQL database operation log (encrypted)

Mysql-bin.index #<== MySQL database operation log index file

Mysqld.pid #<== 3307 Database process number file

Mysql_3307.err #<== 3307 error log • File

Mysql.sock #<== Boot service socket file


This article is from the "Potato" blog, please be sure to keep this source http://zhaoyulin.blog.51cto.com/11665101/1842763

MySQL multi-instance configuration file and startup file

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.