如何在多例項基礎上再新增一個mysql的例項
1)建立資料檔案所需的目錄
1
2
3
|
# mkdir -p /data/3308/data # cp /data/3306/my.cnf /data/3308 # cp /data/3306/mysql /data/3308 |
2)配置許可權
1
2
3
|
# chown mysql.mysql /data/3308 -R # chown root.root /data/3308/mysql # chmod 700 /data/3308/mysql |
3)修改資料配置檔案及啟動指令碼
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# sed -i 's/3306/3308/g' /data/3308/my.cnf # sed -i 's/server-id = 1/server-id = 8/g' /data/3308/my.cnf # cat my.cnf | grep id pid- file = /data/3308/mysql .pid
server- id = 8
pid- file = /data/3308/mysqld .pid
# sed -i 's/3306/3308/g' /data/3308/mysql # cd /application/mysql/scripts/ # ./mysql_install_db --datadir=/data/3308/data --basedir=/application/mysql --user=mysql # /data/3308/mysql start Starting MySQL... # echo $? 0 |
4)檢查資料庫的執行情況
1
2
3
4
|
# netstat -tunlp | grep 330* tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 4052 /mysqld tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 4048 /mysqld tcp 0 0 0.0.0.0:3308 0.0.0.0:* LISTEN 5502 /mysqld
|
5)配置資料庫開機自動啟動
1
2
3
4
5
6
7
|
# echo "/data/3308/mysql start">>/etc/rc.local # tail -4 /etc/rc.local 顯示的結果如下: # mysql multi instances startup /data/3306/mysql start
/data/3307/mysql start
/data/3308/mysql start
|
6)初始化資料庫
1
2
3
4
5
6
7
8
9
10
11
|
設定mysql初始密碼: # mysqladmin -u root -S /data/3308/mysql.sock password 'redhat12345' # mysql -u root -S /data/3308/mysql.sock -predhat12345 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4
Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, Oracle and /or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and /or its
affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
本文轉自 冰凍vs西瓜 51CTO部落格,原文連結:http://blog.51cto.com/molewan/1860235,如需轉載請自行聯絡原作者
相關文章
- canal同步mysql,監聽單例項,多例項配置MySql單例
- MySQL多例項配置MySql
- MySQL5.7 多例項MySql
- mysql多例項安裝MySql
- MySQL 多例項配置管理:MySql
- MySQL多例項環境部署MySql
- Python基礎——切片例項Python
- 多例項資料庫一個用PSU資料庫
- 基礎python5個例項運用Python
- Linux下MySQL多例項部署記錄LinuxMySql
- Mac10.13.6 Mysql5.7.23多例項部署MacMySql
- MySQL介紹及安裝與多例項MySql
- MySQL資料庫入門多例項配置MySql資料庫
- 三通基礎與例項
- SpringBoot基礎篇之重名Bean的解決與多例項選擇Spring BootBean
- Mysql:mysql多例項建立、配置檔案講解【四】MySql
- 多例項資料庫一個用PSU(轉載)資料庫
- 基於mysqld_multi實現MySQL 5.7.24多例項多程式配置MySql
- Python入門基礎知識例項,Python
- android原生開發recyclerview基礎例項AndroidView
- flutter 多例項實戰Flutter
- MySQL 拷貝一個InnoDB分割槽表到另一個例項MySql
- Linux中執行多個MySQL例項LinuxMySql
- frida 建立一個ArrayList例項
- 效能竟然再提升一倍!Redis的一個例項有多快?- keydb.devRedisdev
- 構建一機多例項tomcat叢集Tomcat
- Android Flutter 多例項實踐AndroidFlutter
- 在Windows中執行多個MySQL例項WindowsMySql
- 一個例項中,多個synchronized方法的呼叫synchronized
- 如何區分例項化網格中的每個例項
- Python 動態新增例項屬性,例項方法,類屬性,類方法Python
- 技術乾貨 | 利用systemd管理MySQL單機多例項MySql
- javascript訂閱模式淺析和基礎例項JavaScript模式
- php例項化物件的例項方法PHP物件
- 分享一個Laravel中的管道的使用例項Laravel
- oracle一個listener偵聽多個例項的配置Oracle
- Django+MySQL 例項入門DjangoMySql
- 單例項mysql.yaml kubernetes單例MySqlYAML
- 一個馬爾科夫鏈例項馬爾科夫