Im trying to backup my database using mysqlbackup, but I keep getting this error and I don't know why is refering to a Permission denied error.
I already turned off SeLinux because I thought that would be the cause but there's nothing in the selinux log either, also I can log in to mysql using the normal command: mysql -uuser -ppassword.
The whole password with the output can be seen here: http://pastie.org/10798013
This is because MySQLBackup requires that it be run as root to access needed resources. Normally you would simply run sudo mysqlbackup
, but I believe that this does not work by default for this program.
The quickest thing to do in this case, is run the command as the root user. To do this, all you need to do is open a terminal and type:
sudo -s
You will be prompted for your password, then the terminal will show root@...
instead of the normal user@...
. This indicates that you are now root.
Now you can execute your code again:
mysqlbackup --compress --user=root --socket=/var/lib/mysql/mysql.sock --backup-dir=/home/user/backup backup
Once done, remember to log out of root by simply typing exit
. Remember, do not use the root user unless you have no other choice; it is easy to accidentally change important files/folders unless you are sure of what you are doing.
It is worthwhile to understand more about logging in as root, and even adjusting the configuration so that mysqlbackup
does not require root, so here are some links: