手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

MySQL 5.5配置主从复制

[日期:2012-06-05] 来源:Linux社区  作者:ylw6006 [字体:大 中 小]

二:修改主库my.cnf文件如下,注意红色字体部分,重启数据库实例

  1. [root@dg53 ~]# grep -v '^#' /etc/my.cnf |grep -v '^$'  
  2. [client]  
  3. port            = 3306 
  4. socket          = /tmp/MySQL.sock  
  5. [mysqld]  
  6. port            = 3306 
  7. socket          = /tmp/mysql.sock  
  8. skip-external-locking  
  9. key_buffer_size = 256M 
  10. max_allowed_packet = 1M 
  11. table_open_cache = 256 
  12. sort_buffer_size = 1M 
  13. read_buffer_size = 1M 
  14. read_rnd_buffer_size = 4M 
  15. myisam_sort_buffer_size = 64M 
  16. thread_cache_size = 8 
  17. query_cache_size= 16M 
  18. thread_concurrency = 8 
  19. innodb_data_home_dir =  
  20. innodb_data_file_path = /dev/raw/raw6:1Graw  
  21. log-bin=mysql-bin  
  22. binlog_format=mixed 
  23. server-id=1 
  24. log-bin=mysql-bin  
  25. binlog-do-db=bbs 
  26. binlog-do-db=test 
  27. binlog-ignore-db=mysql 
  28. [mysqldump]  
  29. quick  
  30. max_allowed_packet = 16M 
  31. [mysql]  
  32. no-auto-rehash  
  33. [myisamchk]  
  34. key_buffer_size = 128M 
  35. sort_buffer_size = 128M 
  36. read_buffer = 2M 
  37. write_buffer = 2M 
  38. [mysqlhotcopy]  
  39. interactive-timeout  
  40.  
  41. [root@dg53 ~]# service mysqld restart  
  42. Shutting down MySQL.[  OK  ]  
  43. Starting MySQL..[  OK  ]  
  44.  
  45. [root@dg53 ~]# mysql  
  46. Welcome to the MySQL monitor.  Commands end with ; or \g.  
  47. Your MySQL connection id is 1  
  48. Server version: 5.5.25-log Source distribution  
  49.  
  50. Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.  
  51.  
  52. Oracle is a registered trademark of Oracle Corporation and/or its  
  53. affiliates. Other names may be trademarks of their respective  
  54. owners.  
  55.  
  56. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  57.  
  58. mysql> show master status;  
  59. +------------------+----------+--------------+------------------+  
  60. | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |  
  61. +------------------+----------+--------------+------------------+  
  62. | mysql-bin.000011 |      107 | bbs,test     | mysql            |  
  63. +------------------+----------+--------------+------------------+  
  64. 1 row in set (0.00 sec) 
linux
相关资讯       MySQL教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款