標籤:.gz kconfig nod 配置 blank source use mysql orm
解壓 MySQL 5.7 二進位包到分分彩源碼搭建目錄dashengba,com扣3266397597
[[email protected] ~]# tar zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
建立 MySQL 軟連結
[[email protected] ~]#mv /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/mysql
建立 MySQL 使用者
[[email protected] ~]#groupadd -r mysql
[[email protected] ~]# useradd -r -g mysql -s /bin/false -M mysql
在 MySQL 二進位包目錄中建立 mysql-files 目錄 [MySQL 資料匯入/匯出資料專放目錄]
[[email protected] ~]# mkdir -v /usr/local/mysql/mysql-files
mkdir: created directory `/usr/local/mysql/mysql-files‘
更多源碼下載盡在【大聖源碼論壇】
建立多執行個體資料目錄
[[email protected] ~]# mkdir -vp /data/mysql_data{1..4}
mkdir: created directory /data‘ <br/>mkdir: created directory/data/mysql_data1‘
mkdir: created directory /data/mysql_data2‘ <br/>mkdir: created directory/data/mysql_data3‘
mkdir: created directory `/data/mysql_data4‘
修改 MySQL 二進位包目錄的所屬使用者與所屬組
1 [[email protected] ~]# chown root.mysql -R /usr/local/mysql
修改 MySQL 多執行個體資料目錄與 資料匯入/匯出專放目錄的所屬使用者與所屬組
[[email protected] ~]# chown mysql.mysql -R /usr/local/mysql/mysql-files /data/mysql_data{1..4}
配置 MySQL 設定檔 /etc/my.cnf
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld
mysqladmin = /usr/local/mysql/bin/mysqladmin
log = /tmp/mysql_multi.log
[mysqld1]
# 設定資料目錄 [多執行個體中一定要不同]
datadir = /data/mysql_data1
# 設定sock存放檔案名稱 [多執行個體中一定要不同]
socket = /tmp/mysql.sock1
# 設定監聽開放連接埠 [多執行個體中一定要不同]
port = 3306
# 設定運行使用者
user = mysql
# 關閉監控
performance_schema = off
# 設定innodb 緩衝大小
innodb_buffer_pool_size = 32M
# 設定監聽IP地址
bind_address = 0.0.0.0
# 關閉DNS 反向解析
skip-name-resolve = 0 **
[mysqld2]
datadir = /data/mysql_data2
socket = /tmp/mysql.sock2
port = 3307
user = mysql
performance_schema = off
innodb_buffer_pool_size = 32M
bind_address = 0.0.0.0
skip-name-resolve = 0
[mysqld3]
datadir = /data/mysql_data3
socket = /tmp/mysql.sock3
port = 3308
user = mysql
performance_schema = off
innodb_buffer_pool_size = 32M
bind_address = 0.0.0.0
skip-name-resolve = 0
[mysqld4]
datadir = /data/mysql_data4
socket = /tmp/mysql.sock4
port = 3309
user = mysql
performance_schema = off
innodb_buffer_pool_size = 32M
bind_address = 0.0.0.0
skip-name-resolve = 0
初始化各個執行個體 [ 初始化完成後會內建隨機密碼在輸出日誌中 ]
[[email protected] ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_data1
[[email protected] ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_data2
[[email protected] ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_data3
[[email protected] ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_data4
各執行個體開啟 SSL 串連
[[email protected] ~]# /usr/local/mysql/bin/mysql_ssl_rsa_setup --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_data1
[[email protected] ~]# /usr/local/mysql/bin/mysql_ssl_rsa_setup --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_data2
[[email protected] ~]# /usr/local/mysql/bin/mysql_ssl_rsa_setup --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_data3
[[email protected] ~]# /usr/local/mysql/bin/mysql_ssl_rsa_setup --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_data4
*修改環境變數
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
複製多執行個體指令碼到服務管理目錄下 [ /etc/init.d/ ]
[[email protected] ~]# cp /usr/local/mysql/support-files/mysqld_multi.server /etc/init.d/mysqld_multi
添加指令碼執行許可權
[[email protected] ~]# chmod +x /etc/init.d/mysqld_multi
添加進service服務管理
[[email protected] ~]# chkconfig --add mysqld_multi
啟動測試
查個多執行個體狀態
[[email protected] ~]# /etc/init.d/mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld1 is not running
MySQL server from group: mysqld2 is not running
MySQL server from group: mysqld3 is not running
MySQL server from group: mysqld4 is not running
MySQL多執行個體分分彩源碼搭建安裝部署