MySQL Binary Logs

Discussion in 'Server Operation' started by kevmcool, Sep 9, 2011.

  1. kevmcool

    kevmcool New Member

    CentOS 5.6, MySQL 5.1.52

    Test VM with fresh install of MySQL
    SElinux permissive
    I did was started the server and set the root password
    [root@rhel6 ~]# cat /etc/my.cnf
    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0

    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid

    # Setup for DB replication
    log-bin=mysql-bin

    [root@rhel6 ~]# /etc/init.d/mysqld restart --log-bin
    Stopping mysqld: [ OK ]
    Starting mysqld: [ OK ]
    [root@rhel6 ~]# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.1.52 Source distribution

    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    This software comes with ABSOLUTELY NO WARRANTY. This is free software,
    and you are welcome to modify and redistribute it under the GPL v2 license

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

    mysql> show binary logs;
    ERROR 1381 (HY000): You are not using binary logging
    [root@rhel6 ~]# updatedb
    [root@rhel6 ~]# locate mysql-bin

    So my question is:
    Is binary logging enabled as default?
    How do I enable binary logging?

    Thanks in advance
     
  2. Mark_NL

    Mark_NL Member

    Disable SElinux and try again.
     
  3. kevmcool

    kevmcool New Member

    I turns out that log-bin needs to be in the [mysql] section so now I got binary logs so I can set up a slave and replicate. Cheers
     

Share This Page