how to enable binary logs in mysql
CentOS 5.6, MySQL 5.1.52
Test VM with fresh install of MySQL SElinux permissive yum groupinstall "MySQL Database" All I did was start the server and set the root password for mysql Now I am following How To Set Up Database Replication In MySQL and all is fine until I look for the .bin files and there are none there in: /var/lib/mysql/ The user mysql has read and write on the data directory mysql> SHOW BINARY LOGS; ERROR 1381 (HY000): You are not using binary logging So my question is: Is binary logging enabled as default? How do I enable binary logging? I have been googling this for hours and no luck Thanks in advance |
Hi,
You need to add this to /etc/my.cnf: Code:
log-bin=mysql-bin RMI |
Should the binary logs be created on a restart?
[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 Thanks |
The problem was that log-bin=mysql-bin was added to [mysqld_safe] and not [mysqld]
Thanks |
All times are GMT -5. The time now is 11:07 PM. |