To understand sudo and "."
I am reading MySQL's manuals.
They suggest me that the command
cd /usr/local/mysql
sudo ./bin/mysqld_safe // it seems that sudo = . + master rights
is the same as
. /usr/local/mysql/bin/mysql // only ., no master rights
Are the two commands same in action?
. /some/path
executes [ or includes - which is execution ] a shell script you pointed.
./some/path
[ notice lack of space after dot ] executes program/script using relative path [ from current directory, not from the top of filesystem ]
sudo executes given command with other [ usually root ] user's privileges.
there is difference between
cd /usr/local/mysql
./bin/mysqld_safe
and
/usr/local/mysql/bin/mysqld_safe
the difference is current working directory. for mysql probably that does not meter, but for other/badly written programs that use relative paths - it might meter.
No, those commands are completely different. You may have a typo in there -- the following two commands are equivalent:
cd /usr/local/mysql
sudo ./bin/mysqld_safe
And:
sudo /usr/local/mysql/bin/mysqld_safe
From Freshmeat:
Sudo (su "do") allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.
I'm not sure that you are confused about this, but you might be based on the question.
If you're only confused about why
cd /usr/local/mysql
./bin/mysqld_safe
Is the same as
/usr/local/mysql/bin/mysqld_safe
This is because in UNIX, the . means the current directory. So in this way, you will not search your PATH variable for the nearest mysqld_safe and run it, you will specifically run the one at /usr/local/mysql/bin/.