Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1124643
  • 博文数量: 188
  • 博客积分: 2267
  • 博客等级: 大尉
  • 技术积分: 1907
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-01 11:17
文章分类

全部博文(188)

文章存档

2016年(16)

2015年(16)

2014年(12)

2013年(32)

2012年(45)

2011年(67)

分类: Mysql/postgreSQL

2012-03-19 16:23:14



Master 配置:

 

yum -y install mysql mysql-server

/etc/init.d/mysqld start

chkconfig mysqld on

mysql_secure_installation (除了输入密码外,一路yes到底即可!)

下边貌似还有一个 是否重新加载权限表,截图没截上。。。。。。。。。

mysql -uroot -p123456

mysql> GRANT REPLICATION SLAVE,RELOAD,SUPER ON *.* TO zhouhe@'192.168.1.184' IDENTIFIED BY 'zhouhe';

// 建立一个账户zhouhe(语句中第一个zhouhe),密码为zhouhe(语句中第二个zhouhe),这个账户只能从192.168.1.184 进行操作

mysql> Flush privileges;

mysql> quit

 

 

编辑 /etc/my.cnf 文件,在[mysqld] 下加入以下内容

log-bin=mysql-bin                  //启动二进制日志文件

binlog-do-db=zhouhe              //指定需要同步的数据库名

server-id=1                     //指定id号,需在 1232-1之间

binlog-ignore-db=mysql           //避免mysql用户配置同步

 

/etc/init.d/mysqld restart

Slave 配置:

yum -y install mysql-server mysql

/etc/init.d/mysqld start

mysql_secure_installation

 

编辑/etc/my.cnf

server-id=2                                            //指定id号,id号相当于mysql集群实例名,用于识别数据库身份

master-host=192.168.1.186            //指定连接masterip地址

master-user=zhouhe                          //指定连接 master的用户名

master-password=zhouhe                //指定连接master数据库的密码

master-port=3306                               //指定连接master 数据库的端口

master-connect-retry=3                    //断开重连时间

replicate-ignore-db=mysql       //屏蔽复制mysql数据库用户信息

replicate-do-db=zhouhe         //指定需要同步数据库

 

/etc/init.d/mysqld restart

 

 

 

Master 主机测试:

mysql -uroot -p123456

show master status;

记住这里的 file position

 

 

 

问题1

ERROR:

No query specified

 

Show slave status \G 就是结束  再加一个";" 就多余了,就会报错;

 

问题2

简单设置mysql root密码 mysqladmin -uroot -p password "123456" 

问题3:

mysql链接提示1130

select * from user where user='root';

delete from user where host='127.0.0.1';

delete from user where host='localhost.localdomain';

update user set host = '%' where user ='root';

flush privileges;

理论知识参考:

 

阅读(1434) | 评论(0) | 转发(0) |
0

上一篇:win8 初体验!

下一篇:Lily=HBase+Hadoop+Solr

给主人留下些什么吧!~~