1.mysql編譯安裝完成後,繼續實現mysql的多例項安裝.
2.建立多例項目錄
mkdir -p /data//data
3.然後修改配置檔案,對應不同埠
cp /usr/local/mysql/support-files/my-small.cnf /data/3306/my.cnf
cp /usr/local/mysql/support-files/my-small.cnf /data/3307/my.cnf
3306/my.cnf
[client]
#password = your_password
port = 3306
socket = /data/3306/mysql.sock
# here follows entries for some specific programs
# the mysql server
[mysqld]
port = 3306
socket = /data/3306/mysql.sock
skip-external-locking
key_buffer_size = 16k
max_allowed_packet = 1m
table_open_cache = 4
sort_buffer_size = 64k
read_buffer_size = 256k
read_rnd_buffer_size = 256k
net_buffer_length = 2k
thread_stack = 128k
basedir = /usr/local/mysql
datadir = /data/3306/data
#skip-networking
server-id = 1
3307/my.cnf
[client]
#password = your_password
port = 3307
socket = /data/3307/mysql.sock
# here follows entries for some specific programs
# the mysql server
[mysqld]
port = 3307
socket = /data/3307/mysql.sock
skip-external-locking
key_buffer_size = 16k
max_allowed_packet = 1m
table_open_cache = 4
sort_buffer_size = 64k
read_buffer_size = 256k
read_rnd_buffer_size = 256k
net_buffer_length = 2k
thread_stack = 128k
basedir = /usr/local/mysql
datadir = /data/3307/data
#skip-networking
server-id = 2
4.修改目錄許可權
chown -r mysql.mysql /data/
4.多例項初始化
cd /usr/local/mysql/scripts/
./mysql_install_db –basedir=/usr/local/mysql –datadir=/data/3306/data –user=mysql
./mysql_install_db –basedir=/usr/local/mysql –datadir=/data/3307/data –user=mysql
ps -ef|grep mysql
5.多例項登入
mysql -s /data/3306/mysql.sock
mysql -s /data/3307/mysql.sock
或者mysql -h127.0.0.1 -p3306 -uroot -p
mysql -h127.0.0.1 -p3307 -uroot -p
6.多例項啟動.
mysqld_safe –defaults-file=/data/3306/my.cnf 2>&1 > /dev/null &
mysqld_safe –defaults-file=/data/3307/my.cnf 2>&1 > /dev/null &
7.多例項關閉.
mysqladmin -u root -pylq123 -s /data/3306/mysql.sock shutdown
mysqladmin -u root -pylq123 -s /data/3307/mysql.sock shutdown
8.多例項修改密碼.
mysqladmin -s /data/3306/mysql.sock -u root password 『ylq123』
mysqladmin -s /data/3307/mysql.sock -u root password 『ylq123』
9.在mysql控制台執行系統命令.
system ls
system mysql -s /data/3307/mysql.sock
10.修改mysql提示符
prompt mysql(dev)>
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多例項安裝
注意 5.7.6之後在第五步是不一樣的,具體可以看5.7的官方文件中的安裝。還有這裡的路徑也可以調整,這裡只是給了個例子。1.確保mysql軟體已經安裝在 mysql目錄下 root使用者操作 2.修改環境變數 root使用者操作 修改 etc profile檔案,在檔案末尾新增 path mysq...