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 backupMySQL 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 deniedwhich 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 foundBut 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
Why when I try to execute a program as normal user I get denied, and when I execute it with sudo I get Not Found
bash;sudo;root
So the reason that you're backup is failing as a normal user is because the libdata file that mysqlbackup is attempting to copy/backup is owned by a different user (more than likely, 'mysql') or a privileged user. So, running mysqlbackup as an elevated user is probably the right choice here as you're attempting to do. I surmise that the reason you aren't able to find mysqlbackup as an elevated user is your PATH environment not being set properly or set at all. Am I right to assume that you can't do something like:sudo /usr/bin/mysqldump --compr....If you can then just make sure to run the command with the absolute path to mysqldump. If that doesn't work because of how sudo is configured, then you'll need to try a different tactic like.PATH=/usr/bin sudo mysqlbackup --compress ...Now if that works, great. However, it's not very nice for future command line use. You could create an alias to run mysqlbackup in the future so that you don't need to specify the PATH in the command line for future use:For bash:(for other shells like zsh, you'll need to read the docs on how to set an alias)echo 'alias mysqlbackup=PATH=/usr/bin sudo mysqlbackup' >> ~/.bashrc...which could be invoked, after sourcing the .bashrc file (logout and login is sufficient, or sourcing the file IE . ~/.bashrc), in the future by simply running:mysqlbackup --compress...Let's say none of that works, though. You'll probably need to get the administrator of the machine to change your sudo permissions for mysqlbackup to either include the proper PATH or to specify an absolute path to mysqlbackup in the sudoers file for your ability to call it from the shell when executing sudo.Hopefully that helps.