新聞中心
MySQL數(shù)據(jù)庫的同步實(shí)例演示,本次實(shí)驗(yàn)的主要不得是對MySQL數(shù)據(jù)庫(和PHP搭配之***組合)數(shù)據(jù)庫的主輔同步的配置,沒用的話不多說了,以下就是其具體的實(shí)際配置步驟。 本次試驗(yàn)的MySQL(和PHP搭配之***組合)版本都是 4.1.7-standard-log 。

成都創(chuàng)新互聯(lián)是專業(yè)的藍(lán)田網(wǎng)站建設(shè)公司,藍(lán)田接單;提供網(wǎng)站建設(shè)、網(wǎng)站制作,網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行藍(lán)田網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊,希望更多企業(yè)前來合作!
master 端的操作系統(tǒng)是 redhat 9.0 , slave 端的操作系統(tǒng)是 redhat 7.3.
1.修改 master 端的my.cnf,增加配置參數(shù):
- [MySQL(和PHP搭配之***組合)d]
- log-bin
- server-id=1
2. 修改 slave 端的my.cnf,增加配置參數(shù):
- log-bin
- mastermaster-host=master
- master-user=rep
- master-password=rep
- master-port=3306
- server-id=2
以上參數(shù)都是最基本的配置,就不多解釋了,解下來勢初始化數(shù)據(jù).
1.清空 master 上的所有 binlog,如果現(xiàn)存的 binlog有用的話,請先備份起來;接著把 master 上的所有數(shù)據(jù)文件打包,包括ibdata那些文件.
2.類似的方法清空 slave 上的所有 binlog,將 master上的數(shù)據(jù)文件壓縮包拷貝到自身的數(shù)據(jù)文件目錄下.
啟動master,新增一個rep用戶,
- " grant all privileges on *.* to rep@% identified by 'rep'; flush privileges; ".
啟動slave,檢測同步是否成功.
一般情況下,不成功的原因是slave連接上master之后定位binlog失敗,這就需要將雙方的binlog都設(shè)置成一致,然后stop slave; start slave; 即可.
以上的相關(guān)內(nèi)容就是對MySQL數(shù)據(jù)庫的同步實(shí)例的介紹,望你能有所收獲。
新聞標(biāo)題:MySQL數(shù)據(jù)庫的同步實(shí)例演示
文章地址:http://m.5511xx.com/article/ccdeiso.html


咨詢
建站咨詢
