In order to execute mysqlbackup I have to execute it as root.
Here's the example when I execute it as normal user:
mysqlbackup --compress --user=root --socket=/var/lib/mysql/mysql.sock --backup-dir=/home/user/backup backup MySQL Enterprise Backup version 3.12.2 Linux-2.6.32-400.37.11.el6uek.i686-i686 [2016/01/19] Copyright (c) 2003, 2016, Oracle and/or its affiliates. All Rights Reserved. mysqlbackup: INFO: Starting with following command line ... mysqlbackup --compress --user=root --socket=/var/lib/mysql/mysql.sock --backup-dir=/home/user/backup backup mysqlbackup: INFO: mysqlbackup: INFO: MySQL server version is '5.5.44-MariaDB'. mysqlbackup: INFO: Got some server configuration information from running server. IMPORTANT: Please check that mysqlbackup run completes successfully. At the end of a successful 'backup' run mysqlbackup prints "mysqlbackup completed OK!". 160226 08:30:02 mysqlbackup: INFO: MEB logfile created at /home/user/backup/meta/MEB_2016-02-26.08-30-02_compress_backup.log mysqlbackup: ERROR: Opening of file /var/lib/mysql/ibdata1 failed. Error code: 13, Permission denied
which leads to Permission denied, so I tried to execute it with sudo and I get this:
sudo mysqlbackup [sudo] password for user: sudo: mysqlbackup: command not found
But when I execute it as a root I don't have any problems...
my user is inside of the sudoers file just so you know and I can also execute other commands with sudo with no problems, but in this case my question is, why I can't execute it with sudo and how I can be able to execute it without recurring to sudo -i to get the root environment?
Note: They both have the same $PATH
[root@localhost ~]# echo $PATH /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin [root@localhost ~]# exit [user@localhost backup]$ echo $PATH /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin