mysql 5.7 多例項安裝
一 例項一
[root@localhost ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/3306/data
2017-03-03T07:04:07.762686Z 1 [Note] A temporary password is generated for root@localhost: uE70uYprtw?d
[root@localhost ~]# vi /data/3306/my.cnf
[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
|
/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/3306/my.cnf 2>&1 > /dev/null &
/usr/local/mysql/bin/mysql -uroot -puE70uYprtw?d -S /data/3306/soket/mysql.sock
mysql> set password = password('123456');
mysql> flush privileges;
啟動指令碼:
[root@localhost ~]# vi /data/3306/mysqld
#!/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
|
二 例項二
[root@localhost ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/3307/data
2017-03-03T07:30:47.741108Z 1 [Note] A temporary password is generated for root@localhost: (+9QZ2l<mbt.
[root@localhost ~]# cp /data/3306/my.cnf /data/3307/
[root@localhost ~]# cp /data/3306/mysqld /data/3307/
[root@localhost ~]# vi /data/3307/my.cnf 把3306替換3307
[root@localhost ~]# vi /data/3307/mysqld 把3306替換3307
[root@localhost ~]# chown mysql:mysql /data/3307/my.cnf
[root@localhost ~]# chown mysql:mysql /data/3307/mysqld
[root@localhost ~]# /data/3307/mysqld start
[root@localhost ~]# /usr/local/mysql/bin/mysql -uroot -p(+9QZ2l<mbt. -s="" data="" 3307="" soket="" mysql.sock
</mbt.<>
mysql> set password = password('123456');
mysql> flush privileges;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28572479/viewspace-2134683/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL5.7 多例項MySql
- mysql多例項安裝MySql
- MySQL介紹及安裝與多例項MySql
- mysql 5.7單例項安裝MySql單例
- MySQL在Windows和Linux平臺上多版本多例項安裝配置方法(5.5、5.6、5.7、8.0)MySqlWindowsLinux
- MySQL單機多例項安裝並配置主從複製MySql
- Docker 安裝 Mysql 5.7DockerMySql
- mysql多例項部署MySql
- MySQL多例項配置MySql
- CentOS 7 - 安裝MySQL 5.7CentOSMySql
- CentOS 7 安裝 MySQL 5.7CentOSMySql
- mysql5.7 安裝教程MySql
- centos安裝mysql5.7CentOSMySql
- MySQL多例項環境部署MySql
- mysql的多例項配置MySql
- 單機多例項執行 percona server 5.7Server
- CentOS 7.4 環境下原始碼編譯(多例項)安裝 Mysql 5.7.26CentOS原始碼編譯MySql
- Windows安裝MySQL5.7教程WindowsMySql
- Linux下安裝MySQL 5.7LinuxMySql
- Linux 7 安裝Mysql 5.7LinuxMySql
- CentOS 6.5/6.6 安裝mysql 5.7CentOSMySql
- MySQL 5.7安裝部署總結MySql
- 用OneinStack安裝mysql 5.7MySql
- MySQL 多例項配置管理:MySql
- MySQL單機多例項配置MySql
- MySQL:mysql5.7解壓版安裝與解除安裝MySql
- debian-mysql5.7安裝與解除安裝MySql
- Mysql 5.7 免安裝版windows安裝完整教程MySqlWindows
- CentOS7.3 安裝 MySQL5.7CentOSMySql
- Ubuntu 18.04 安裝配置 MySQL 5.7UbuntuMySql
- CentOS7 安裝mysql5.7CentOSMySql
- mysql5.7tar包的安裝MySql
- macOS Mojave 降級安裝 MySQL 5.7MacMySql
- MySQL5.7綠色版安裝MySql
- 如何在debain上安裝mysql 5.7AIMySql
- mysql5.7安裝_centos7MySqlCentOS
- ubuntu16 安裝mysql5.7UbuntuMySql
- windows安裝及配置mysql5.7WindowsMySql