LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 09-08-2011, 03:43 PM   #1
kevmcool
Member
 
Registered: Dec 2009
Location: London
Distribution: CentOS
Posts: 36

Rep: Reputation: 15
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

Last edited by kevmcool; 09-08-2011 at 03:44 PM.
 
Old 09-08-2011, 05:17 PM   #2
zackwasa
Member
 
Registered: Sep 2011
Posts: 52

Rep: Reputation: Disabled
Hi,

You need to add this to /etc/my.cnf:
Code:
log-bin=mysql-bin
The logs will go to the mysql data directory and will have the mysql-bin prefix

RMI

Last edited by zackwasa; 01-12-2012 at 01:53 AM.
 
Old 09-09-2011, 03:48 AM   #3
kevmcool
Member
 
Registered: Dec 2009
Location: London
Distribution: CentOS
Posts: 36

Original Poster
Rep: Reputation: 15
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
 
Old 09-09-2011, 05:38 AM   #4
kevmcool
Member
 
Registered: Dec 2009
Location: London
Distribution: CentOS
Posts: 36

Original Poster
Rep: Reputation: 15
The problem was that log-bin=mysql-bin was added to [mysqld_safe] and not [mysqld]

Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Purging Binary logs in MySQL Replication ajayan Linux - Newbie 15 09-22-2010 07:07 AM
binary logs parimi_777 Linux - General 3 08-25-2010 11:06 AM
PHP5 binary with enable-sockets OliXNet Linux - Newbie 1 11-16-2006 02:37 AM
how to view binary logs true_atlantis Linux - Newbie 4 04-05-2006 09:06 PM
Change name of mysql's binary logs Ratclaws Linux - Software 0 09-07-2005 02:53 PM


All times are GMT -5. The time now is 09:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration