Mysql双主模式
安装mysql
yum list mysql-server
yum install mysql-server
service mysqld start
修改mysql密码: mysql> set password for ******@localhost = password('123');
环境:
mysql 5.*
设置同步账号密码及权限
Db1:
mysql> grant all privileges on *.* to ******@ identified by 'root' with grant option;
mysql> flush privileges;
Db2:
grant all privileges on *.* to ******@ identified by 'root' with grant option;
mysql> flush privileges;
测试:
mysql -h -usroot -proot
mysql -h -usroot -proot
修改MySQL配置文件
修改 vim /etc/f
以root登陆DBS1,vim /etc/f 文件:
Vim /etc/f
在[mysqld]的配置项中增加如下配置:
[client]
port = 3306
socket = /var/lib/mysql/
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/
user=mysql
# Disabling symbolic-links is mended to prevent assorted security risks
symbolic-links=0
port=3306
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 2
log-bin=mysql-bin
relay-log=mysql-relay-log
binlog_format=mixed
server-id = 1
auto-increment-increment=10
auto-increment-offset=1
以root用户登录ServDB2,f文件:
[client]
port = 3306
socket = /var/lib/mysql/
[mysqld]
port=3306
datadir=/var/lib/mysql
socket=/var/lib/mysql/
user=mysql
# Disabling symbolic-links is mended to prevent assorted security risks
symbolic-links=0
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 2
log-bin=mysql-bin
binlog_format=mixed
server-id = 2
auto-increment-increment=10
auto-increment-offset=2
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
n
Mysql双主模式 来自淘豆网m.daumloan.com转载请标明出处.