多套后臺(tái)進(jìn)程+線程+內(nèi)存結(jié)構(gòu)
創(chuàng)新互聯(lián)建站是一家專注于網(wǎng)站設(shè)計(jì)制作、成都做網(wǎng)站與策劃設(shè)計(jì),渭城網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)建站做網(wǎng)站,專注于網(wǎng)站建設(shè)10余年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:渭城等地區(qū)。渭城做網(wǎng)站價(jià)格咨詢:028-86922220
多個(gè)端口,多個(gè)配置文件,多個(gè)日志文件,多個(gè)socket,多個(gè)server_id
多套數(shù)據(jù)
##PS:安裝多實(shí)例前,首先確保MySQL數(shù)據(jù)庫(kù)已安裝,mysql安裝參考:https://blog.51cto.com/zhuzhiwei/2140683
mkdir -p /data/330{7..9} #<=====創(chuàng)建多個(gè)目錄
================第一個(gè)實(shí)例===================
vim /data/3307/my.cnf
[mysqld]
basedir=/application/mysql
datadir=/data/3307/data
socket=/data/3307/mysql.sock
log-error=/data/3307/mysql.log
log-bin=/data/3307/mysql-bin
server-id=7
port=3307
[client]
socket=/data/3307/mysql.sock
================第二個(gè)實(shí)例===================
vim /data/3308/my.cnf
[mysqld]
basedir=/application/mysql
datadir=/data/3308/data
socket=/data/3308/mysql.sock
log-error=/data/3308/mysql.log
log-bin=/data/3308/mysql-bin
server-id=8
port=3308
[client]
socket=/data/3308/mysql.sock
================第三個(gè)實(shí)例===================
vim /data/3309/my.cnf
[mysqld]
basedir=/application/mysql
datadir=/data/3309/data
socket=/data/3309/mysql.sock
log-error=/data/3309/mysql.log
log-bin=/data/3309/mysql-bin
server-id=9
port=3309
[client]
socket=/data/3309/mysql.sock
=========================================
chown -R mysql.mysql /data/330* #<======將3個(gè)目錄授權(quán)給mysql用戶
/application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/data/3307/data
=================================================================================
/application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/data/3308/data
=================================================================================
/application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/data/3309/data
=================================================================================
mysqld_safe --defaults-file=/data/3307/my.cnf &
====================================================================
mysqld_safe --defaults-file=/data/3308/my.cnf &
====================================================================
mysqld_safe --defaults-file=/data/3309/my.cnf &
====================================================================
touch /data/3309/mysql.log
touch /data/3308/mysql.log
touch /data/3307/mysql.log
chown -R mysql.mysql /data/330*
再次啟動(dòng)多個(gè)實(shí)例即可。
===============進(jìn)入實(shí)例===============================
mysql -s /data/3307/mysql.sock #首次進(jìn)入無密碼
mysql -s /data/3308/mysql.sock
mysql -s /data/3309/mysql.sock