tags:

views:

52

answers:

2

How do I throw the contents of binary log to bit bucket? I tried to create a soft link but it did not work. I do not want to save mysql general log but I want to watch it using tail -f command.

ln -s /dev/null /var/log/mysql/mysql-gen.log

ln: creating symbolic link /var/log/mysql/mysql-gen.log to /dev/null: File exists

+2  A: 

You have to remove the log file (/var/log/mysql/mysql-gen.log) first before creating it as a symbolic link.

/tmp/test>touch somefile
/tmp/test>ln -s /dev/null somefile
ln: creating symbolic link `somefile': File exists
/tmp/test>rm somefile
/tmp/test>ln -s /dev/null somefile
/tmp/test>ls -l somefile
lrwxrwxrwx 1 user group 9 Oct 16 17:04 somefile -> /dev/null
/tmp/test>
hlovdal
+1  A: 
ln -fs /dev/null /var/log/mysql/mysql-gen.log

See man 1 ln or info coreutils 'ln invocation'.

-f
--force
    Remove existing destination files.

ephemient