- mkdir -p /data/master
- mkdir -p /data/slave
- mkdir -p /data/master_binlog
- mkdir -p /data/slave_binlog
- mkdir /var/log/mysql1
- mkdir/var/log/mysql2
- chown mysql.mysql /data/master -R
- chown mysql.mysql /data/slave -R
- chmod 777 /var/log/mysql1
- chmod 777/var/log/mysql2
- chmod 777 /var/lib/mysql
/usr/local/mysql/scripts/mysql_install_db--datadir=/data/master
/usr/local/mysql/scripts/mysql_install_db--datadir=/data/slave
4. 安裝工具
5.修改環(huán)境變量
- cp /usr/local/mysql/bin/my_print_defaults /usr/bin/
- cp /usr/local/mysql/bin/mysqld_multi /usr/bin
1.mysql啟動(dòng)
應(yīng)縣網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),應(yīng)縣網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為應(yīng)縣上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的應(yīng)縣做網(wǎng)站的公司定做!
- mysqld_multi start 1 啟動(dòng)實(shí)例1
- mysqld_multi start 1-2 啟動(dòng)實(shí)例1,2
2.命令行登陸
- mysql -u your_user -p your_password -P3307 -S /tmp/mysql3307.sock
由于涉及權(quán)限問(wèn)題,mysqld_multi不能控制關(guān)閉mysql多實(shí)例,自己寫了個(gè)關(guān)閉腳本#!/bin/bashuser=""password=""read -p "Please input mysqld ID 1-2:" IDif [ "$ID" == "1" ]; then#read -p "Please input mysqld port number 3306-3307:" port/usr/local/mysql/bin/mysqladmin -u$user -p$password -S /var/lib/mysql/mysql3306.sock shutdown && echo "close mysqld master successful"elif [ "$ID" == "2" ]; then/usr/local/mysql/bin/mysqladmin -u$user -p$password -S /var/lib/mysql/mysql3307.sock shutdown && echo "close mysqld slave successful"elseecho "Please input mysqld ID 1-2:"fi