首页 > 数据库 > MySQL > mysql 5.7 多实例安装
|
[client]
port = 3306
socket = /data/3306/soket/mysql.sock
[mysql]
no-auto-rehash
[mysqld]
server-id = 1
user = mysql
port = 3306
socket = /data/3306/soket/mysql.sock
basedir = /usr/local/mysql
datadir = /data/3306/data
open_files_limit = 10240
back_log = 600
max_connections = 3000
max_connect_errors = 6000
table_open_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
thread_cache_size = 300
query_cache_size = 64M
query_cache_limit = 4M
default-storage-engine = InnoDB
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 256M
max_heap_table_size = 256M
long_query_time = 4
slow_query_log_file=/data/3306/logs/slow-log.log
slow_query_log
log-bin = /data/3306/logs/ray-bin.log
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 512M
expire_logs_days = 7
key_buffer_size = 256MB
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
skip-name-resolve
lower_case_table_names = 1
innodb_buffer_pool_size = 512M
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = on
[mysqldump]
quick
max_allowed_packet = 32M
[mysqld_safe]
log-error=/data/3306/logs/mysql_ray.err
pid-file=/data/3306/logs/ray.pid
|
|
#!/bin/bash
mysql_port=3306
mysql_username="root"
mysql_password="123456"
function_start_mysql()
{
printf "Starting MySQL...\n"
/bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/${mysql_port}/my.cnf 2>&1 > /dev/null &
}
function_stop_mysql()
{
printf "Stoping MySQL...\n"
/usr/local/mysql/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /data/${mysql_port}/soket/mysql.sock shutdown
}
function_restart_mysql()
{
printf "Restarting MySQL...\n"
function_stop_mysql
function_start_mysql
}
function_kill_mysql()
{
kill -9 $(ps -ef | grep 'bin/mysqld_safe' | grep ${mysql_port} | awk '{printf $2}')
kill -9 $(ps -ef | grep 'libexec/mysqld' | grep ${mysql_port} | awk '{printf $2}')
}
case $1 in
start)
function_start_mysql;;
stop)
function_stop_mysql;;
kill)
function_kill_mysql;;
restart)
function_stop_mysql
function_start_mysql;;
*)
echo "Usage: /data/${mysql_port}/mysqld {start|stop|restart|kill}";;
esac
|
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28572479/viewspace-2134683/ ,如需转载,请注明出处,否则将追究法律责任。