參考:http://www.cnblogs.com/DavidYan/articles/2531181.html html
數據庫掛載:mysql
linux下,mysql安裝後,數據庫的數據默認存放在/var/lib/mysql目錄下,若是該目錄下掛載的磁盤空間不多,不夠用。須要遷移到其餘的目錄位置。linux
方法一:sql
參照windows下的方法,把/var/lib/mysql移到須要的目錄,再修改/etc/my.cnf文件,指定數據目錄。這方面的教程網上不少,你們能夠去搜索一下。數據庫
方法二:windows
使用linux下的軟鏈接方法,具體操做以下:(以遷移到/home/mysql/目錄爲例)服務器
先中止mysql:ide
/etc/init.d/mysqld stop
移動數據:spa
mv /var/lib/mysql/* /home/mysql/
建立軟鏈接:日誌
ln -s /home/mysql/ /var/lib/mysql/
啓動mysql:
/etc/init.d/mysqld start
便可。
開啓遠程訪問全新啊:grant all PRIVILEGES on bailun_ana.* to bailun@'%' identified by 'bailun_ana';
discuz 數據庫的全部權限受權給 ted 這個用戶
flush privileges;
去掉bind ~
1,建立用戶
grant replication slave on *.* to 'rep1'@'192.168.%.%' identified by 'fuhan'
2,定義日誌
主服務器「
在[mysqld]下面增長下面幾行代碼
server-id=1 //給數據庫服務的惟一標識,通常爲你們設置服務器Ip的末尾號
log-bin=master-bin
log-bin-index=master-bin.index
查看日誌
show master status
次服務器:1 [mysqld]
server-id=2
relay-log-index=slave-relay-bin.index
relay-log=slave-relay-bin
change master to master_host='192.168.242.1',
master_user='rep1',
master_password='fuhan',
master_log_file='mysql-bin.000002',
master_log_pos=1168;
單次修改:CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000004',MASTER_LOG_POS=120;
查看配置
show slave status\G
報錯:
Slave can not handle replication events with the checksum that master is configured to log;
解決,主機mysqld裏面設置:
flush logs;
binlog_checksum =none