Forum Moderators: open
I am trying to change the location of where my MySQL binary logs are kept as I want them stored to my back up drive.
Currently they are being written to /var/lib/mysql/bin.log which is the Redhat default location but I would like to write them to /backup/mysql/binary/bin.log.
I added the following to my.cnf
log-bin = /backup/mysql/binary/bin.log
but I can't get MySQL to write to that location. I tried changing the permissions of the mysql folder to mysql:mysql and 660 but it's still not working.
Any ideas?
I have a second drive for backup files. I mounted the second drive to /backup
I run scripts each night that backup all of the cpanel accounts to /backup/$todaysdate
I then created a directory /backup/mysql and I run a script each night that backs up all my databases and stores it in that directory.
I created a new directory /backup/mysql/binary where I want to store the binary files
I added the following to my.cnf
log-bin = /backup/mysql/binary/bin.log
I set the permissions on /backup/mysql/binary to mysql:mysql and chmod 660 which is what the permissions for /var/lib/mysql is set to.
This is all I've done. It sounds like what you're talking about is mapping /backup/mysql/binary to /var/lib/mysql?
Ok, I'm obviously way off course. Let's start from scratch.
My fault - I was making too many assumptions about how you would mount partitions from your backup drive - but you're not doing it the way I imagined.
I have a second drive for backup files. I mounted the second drive to /backup
Who owns the /backup directory and what are its permissions? The way you're doing it, you need to have at least read access for everyone, otherwise the mysql user won't be able to list the subdirectories to get down to /backup/mysql/binary/...
I run scripts each night that backup all of the cpanel accounts to /backup/$todaysdate
I then created a directory /backup/mysql and I run a script each night that backs up all my databases and stores it in that directory.
I created a new directory /backup/mysql/binary where I want to store the binary files
I added the following to my.cnf
log-bin = /backup/mysql/binary/bin.log
I set the permissions on /backup/mysql/binary to mysql:mysql and chmod 660 which is what the permissions for /var/lib/mysql is set to.
This is all I've done.
Check the permissions in /backup, /backup/mysql, and /backup/mysql/binary and see what the permissions are.
It sounds like what you're talking about is mapping /backup/mysql/binary to /var/lib/mysql?
I thought you'd be mounting a partition from your backup drive somewhere UNDER the /var/lib/mysql folder.
/backup is
rw------- 17 root root 4096 Mar 14 03:00 ./
/backup/mysql is
rwx--x--x 4 root root 4096 Mar 13 07:43 mysql/
/backup/mysql/binary is
rwx--x--x 2 root root 4096 Mar 10 13:25 binary/
Which is odd because I set the permissions on binary to mysql:mysql and 660.
So, backup, mysql and binary should probably be
rw-rw----
and binary should be chown mysql:mysql
Right?
If you give everyone read access on /backup, /backup/mysql, and /backup/mysql/binary, and make sure that mysql:mysql is the owner of /backup/mysql/binary then I reckon this will fix the problem.