设为首页 加入收藏

TOP

MySQL主从复制配置-windows单机环境(二)
2014-11-24 03:28:33 来源: 作者: 【 】 浏览:3
Tags:MySQL 主从 复制 配置 -windows 单机 环境
440636c-b4f1-11e3-9ec4-904ce5e379cc. 2014-03-26 22:20:49 7204 [Note] Server hostname (bind-address): '*'; port: 3310 2014-03-26 22:20:49 7204 [Note] IPv6 is available. 2014-03-26 22:20:49 7204 [Note] - '::' resolves to '::'; 2014-03-26 22:20:49 7204 [Note] Server socket created on IP: '::'. 2014-03-26 22:20:50 7204 [Note] Event Scheduler: Loaded 0 events 2014-03-26 22:20:50 7204 [Note] mysqld: ready for connections. Version: '5.6.16-log' socket: '' port: 3310 MySQL Community Server (GPL) 4.在master上创建一个复制用户 4.1修改默认的root密码 如果是已有的数据库则该步骤,则修改密码部分省略 C:/software/mysql-5.6.16-winx64-3310\mysqladmin -uroot password 111111 通过如上命令,我们给默认的root帐号一个密码111111 4.2添加复制用户并给予权限: C:/software/mysql-5.6.16-winx64-3310 \mysql -uroot -p111111 进入到my sql数据库
mysql> create user repl_user; Query OK, 0 rows affected (0.00 sec) mysql> mysql> grant replication slave on *.* to repl_user identified by '111111'; Query OK, 0 rows affected (0.00 sec) mysql>
replication slave这个权限没有什么特别之处,只是这个用户可以从master上取得二进制的日志转储数据,完全可以给一个常规帐号赋予replication slave权限,但是最好还是将replication slave权限和其他用户权限分开,这样的话,如果后期想禁止某些slave的链接,只要删除该用户就可以了 5.配置slave 将压缩包解压: C:/software/mysql-5.6.16-winx64-3311 在这个目录下建立tmp文件夹 在该目录下新增my.ini文件,其内容如下:
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults. html # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [ mysqld] server-id=2 #replicate-same-server-id=0 # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. basedir = C:/software/mysql-5.6.16-winx64-3311 datadir = C:/software/mysql-5.6.16-winx64-3311/data tmpdir = C:/software/mysql-5.6.16-winx64-3311/tmp port = 3311 relay-log = slave-relay-bin relay-log-index = slave-relay-bin.index #default-character-set = utf8 # server_id = ..... # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [client] port = 3311 #default-character-set = utf8
与master一样,slave也要配置一个唯一的服务器id,relay-log和relay-log-index表示中继日志文件和中继日志索引文件 6.启动slave 命令行切换到 C:\software\mysql-5.6.16-winx64-3311\bin(slave解压目录),执行mysqld --console命令,得如下信息,则slave启动完毕:
C:\software\mysql-5.6.16-winx64-3311\bin>mysqld --console 2014-03-26 22:21:19 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2014-03-26 22:21:19 6916 [Note] Plugin 'FEDERATED' is disabled. 2014-03-26 22:21:19 6916 [Note] InnoDB: Using atomics to ref count buffer pool pages 2014-03-26 22:21:19 6916 [Note] InnoDB: The InnoDB memory heap is disabled 2014-03-26 22:21:19 6916 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2014-03-26 22:21:19 6916 [Note] InnoDB: Compressed table
首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇mysql给表添加字段的命令 下一篇mysql常用语句

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·数据库:推荐几款 Re (2025-12-25 12:17:11)
·如何最简单、通俗地 (2025-12-25 12:17:09)
·什么是Redis?为什么 (2025-12-25 12:17:06)
·对于一个想入坑Linux (2025-12-25 11:49:07)
·Linux 怎么读? (2025-12-25 11:49:04)