前文-mysql單機版安裝
以前一些很 low 的方法是,解壓兩個 mysql,分別放到不同資料夾,其實在 mysql 中已經考 慮到了多例項安裝的情況。也有相應的指令碼命令的支援。
現在要求裝兩個 mysql 乙個 3307,3308
新建 /etc/my.cnf 配置如下
[mysqld]
sql_mode=
"strict_trans_tables,no_engine_substitution,no_zero_date,no_zero_in_date,error_for_division_by_zero,no_auto_create_user"
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
log = /var/log/mysqld_multi.log
user=root
pass=root1234%
[mysqld1]
server-id = 11
socket = /tmp/mysql.sock1
port = 3307
datadir =/data1
user = mysql
performance_schema = off
innodb_buffer_pool_size = 32m
skip_name_resolve = 1
log_error = error.log
pid-file = /data1/mysql.pid1
[mysqld2]
server-id = 12
socket = /tmp/mysql.sock2
port = 3308
datadir = /data2
user = mysql
performance_schema = off
innodb_buffer_pool_size = 32m
skip_name_resolve = 1
log_error = error.log
pid-file = /data2/mysql.pid2
建立 2 個資料目錄
mkdir /data1
mkdir /data2
賦予許可權
chown mysql.mysql /data
mysqld --initialize --user=mysql --datadir=/data1
mysqld --initialize --user=mysql --datadir=/data2
cp /usr/local/mysql/support-files/mysqld_multi.server /etc/init.d/mysqld_multid
配置開機啟動
chkconfig mysqld_multid on
檢視狀態
mysqld_multi report
這個時候發現還需要 perl 的環境,安裝
yum -y install perl perl-devel
在執行,發現已經有例項了
mysqld_multi start
啟動,分別修改密碼,允許遠端連線
mysql -u root -s /tmp/mysql.sock1 -p -p3307
mysql -u root -s /tmp/mysql.sock2 -p -p3308
set password =
'root1234%'
;grant
allprivilegeson*
.*to'root'@'%
' identified by 'root1234%';
flush privileges
;
mysql安裝 例項 mysql安裝多例項
多例項管理 3.5.1準備多個目錄 mkdir p data 330 data 3.5.2 準備配置檔案 cat data 3307 my.cnf mysqld basedir softmysql mysql datadir data 3307 data socket data 3307 mysql...
mysql多例項命令 mysql多例項安裝
1 編輯my.cnf檔案增加相關引數如下 mysqld multi user root pass 123 mysqld usr local mysql bin mysqld safe mysqladmin usr local mysql bin mysqladmin log usr local my...
Mysql多例項安裝
1.mysql編譯安裝完成後,繼續實現mysql的多例項安裝.2.建立多例項目錄 mkdir p data data 3.然後修改配置檔案,對應不同埠 cp usr local mysql support files my small.cnf data 3306 my.cnf cp usr loca...