I am runnin OSX 10.9.5 and while trying to reset my MySQL root pasword I typed this:
sudo mysqld_safe –skip-grant-tables
After being asked for the admin password, I got this error :
sudo: mysqld_safe: command not found
I wrote this in
Also, I have a problem with the sudo command, event though I am logged on the admin account my account, It gives me often permission denied, like using this command for basically the same problem ( reseting my root password )
I then got
cat: /usr/local/mysql/data/rodongi.pid: Permission denied
After entering the password …
usage: kill [-s signal_name] pid …
kill -l [exit_status]
kill -signal_name pid …
kill -signal_number pid …
I have no idea why
- 1) I dont have the permission even though I used the sudo command( and another time sudo!! )
- 2) Why msql-bash doesn’t not recognise the mysql and mysqld command ( I also tried in terminal-bash;does not work either)
You’re trying to execute the command
mysqld_safe, so that command should be on the PATH where the terminal looks for commands. (You can view these locations by running
echo $PATH. The different locations are separated with a colon).
Since you’re trying to run a file that is in the local directory you should type
./mysqld_safe to tell the shell that you’re giving a path to file, otherwise it’ll search for it in the PATH. (You can run the file from anywhere by specifying the full path).
Another solution is to make a symbolic link in
/usr/local/bin/ that points to /usr/local/mysql/mysqld_safe` (which is the path to the command if I understood you correctly). That way you can run the command from anywhere because it’s in the path the shell is looking for.
cat command surrounded by backticks is executed by the shell before running the sudo command (If the file was readable for everyone the shell will execute something like:
sudo kill 12345).
To run the
cat as root you should run this command:
sudo bash -c 'kill `cat /usr/local/mysql/data/rodongi.pid`'
That way, you run bash as root, which in turn runs the
kill command, and thus reads the
rodongi.pid file as root.