mysql logo
หลังจากได้เตรียม server สำหรับ MySQL replication ด้วยการทำให้ข้อมูลของทั้งสองเครื่องเหมือนกันเรียบร้อยแล้ว ก็มาถึงขั้นตอนการ setup replication ซึ่งขั้นตอนนี้จะต้องรันคำสั่ง “show master status” เพื่อตรวจสอบ bin-log และ position ที่เครื่อง master เพื่อนำข้อมูลที่ได้ไปใช้กับคำสั่ง CHANGE MASTER TO ที่เครื่อง slave แต่เมื่อรันคำสั่ง “show master status” ที่เครื่อง master แล้วกลับพบว่าได้ผลลัพธ์ “Empty set (0.00 sec)” มาแทนที่จะได้ข้อมูล bin-log และ position และเมื่อไปตรวจสอบที่ไฟล์ error log ของ MySQL กลับไม่มีข้อมูลอะไรเลย ต่อมาจึงลองใช้คำสั่ง “show binary logs” เพื่อตรวจสอบข้อมูลของ binary log ก็พบข้อความว่า “ERROR 1381 (HY000): You are not using binary logging” ซึ่งทำให้รู้ว่าน่าจะเกิดปัญหาจากการสร้าง binary log ไฟล์

[shell]
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 117905
Server version: 5.5.14-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> show master status;
Empty set (0.00 sec)

mysql> show binary logs;
ERROR 1381 (HY000): You are not using binary logging
[/shell]

วิธีแกัไขสามารถทำได้ดังนี้
ให้ตรวจสอบก่อนว่าใน /etc/my.cnf ได้มีค่า log-bin นี้แล้วหรือยัง ถ้ายังไม่มีให้ใส่ตามตัวอย่างด้านล่างได้ดังนี้
log-bin = /var/lib/mysql/log-bin

แต่ถ้ามีแล้วก็แสดงว่าเป็นปัญหาที่ permission ของ directory ที่ใช้เก็บ bin-log ไฟล์ วิธีแก้ไขคือให้ owner และ group ของ directory นี้เป็น mysql โดยสามารถทำตามตัวอย่างด้านล่างได้ดังนี้
[shell]
[root@ezylinux ~]# service mysql stop
[root@ezylinux ~]# chown -R mysql:mysql /path/of/bin-log
[root@ezylinux ~]# service mysql start
[/shell]