Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a RedHat Linux server and I'm trying to make a copy of /var/lib/mysql/ibdata1, but I'm receiving an error saying permission denied and the file cannot be opened.

I'm logged in as root user and tried to use sudo cp...

Any idea of what I'm doing wrong? Sorry for my ignorance, but I don't know much about Unix systems. I was trying sudo su mysql to make the copy, then it asks for a password that should be the one I have, but it is saying it's wrong!

share|improve this question
Are you receiving permission denied errors or open file, cannot read etc..check SELinux permissions/constructs. – Nikhil Mulley Dec 14 '11 at 14:22
I'm receiving Pessision Denied -> cp: cannot open 'ibdata1.bak' for reading: Permission denied – guiligan Dec 14 '11 at 14:35
Can you post the output of ls -l /var/lib/mysql/ibdata.bak and of id? We can see if it is a permissions issue. – n0pe Dec 14 '11 at 15:05
If you are loged in as root you should not use sudo or su just run the cp command. – Hanan N. Dec 14 '11 at 17:12
ls -Z output? btw, did you stop mysqld before starting to copy. On the other hand, use rsync with --partial and to make sure your data is copied from where it stopped. – Nikhil Mulley Dec 14 '11 at 19:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.