Shell command?

I'm trying to reset my MySQL password in Terminal (OSX user) and am feeling my way through the process, as I know very little Unix. The guide I'm using suggests the following command as the final step:

shell> mysqld_safe --init-file=~/mysql-init &

to which Terminal responds (when I do it) with:
[1] xxxx
thomas-computer:~ root# -sh: shell: command not found

or something to that effect. substitue some numbers for the x (typically 1300-1500)

The method can be seen here:
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

I've created the password file in the root directory, and have found the file I believe to be the correct .pid

What am I doing wrong? Can someone pleeease guide me through this?

I"m guessing somewhat - but I think the console is trying to use sh.

Like bash, and ksh, sh is a shell - that means it should be an executable named "sh"
that lives in /usr/bin

On some linux systems sh is a link (a kind of file that points to another file)

When you are at the command line in unix, post the output of these commands:

which sh
echo $PATH
ls  -l /usr/bin/sh

All of the commands I entered were preceded by:
thomas-computer:~ root#

which sh
yielded
/bin/sh

echo $PATH
yielded
/bin:/sbin:/usr/bin:/usr/sbin

and

ls -l /usr/bin/sh
yielded
ls: /usr/bin/sh: No such file or directory

Then for some reason your PATH is not finding the mysqld_safe part of the command.

try

./mysqld_safe --init-file=~/mysql-init &

Note the dot - slash at the start of the command.

This is killing me. I've been trying different methods for three days now, and still no luck. Part of the problem may be that the previous command has never been successful either:

shell> kill `cat /mysql-data-directory/host_name.pid`

because this hasn't worked (you can see it in the link from my original post) I've shut off the server using my preferences pane in OSX. In any case,

shell> ./mysqld_safe --init-file=~/mysql-init &

hasn't worked for me, unfortunately. I get the same old "-sh: shell: command not found" error.

thomas-computer:~ root# -sh: shell: command not found

My interpretation is that sh could not find some program called "shell".

Can someone please guide me through the last few steps once more? I'm pretty sure I know the .pid file location, and I've created the text file the solution calls for. I simply can't get the final two steps to work... Can a Unix Guru please guide me through these final two steps? I'm running Mac OS 10.4 with the latest stable MySQL.

I have reviewed that page you linked and I think that I see the problem. The shell has a prompt to tell you to type something. The prompt is programmable and can be almost anything. It looks like your prompt might be "thomas-computer:~ root# ". There is no way that the author of that page could have predicted that. Now, in this line:
shell> kill `cat /mysql-data-directory/host_name.pid`
The "shell> " represents your shell's prompt. It is not something that you are supposed to type.

OK Thanks for the tip. I'll give it a try and update tomorrow.

No luck. I tried:

mysqld_safe --init-file=~/mysql-init &

and got back

-sh: mysqld_safe: command not found

I then tried

> mysqld_safe --init-file=~/mysql-init &

and got back

[1] 367
[1]+  Done(127)             --init-file=~/mysql-init >mysqld_safe

I ran both of these with the MySQL server off, as the instructions said. I am growing very frustrated! I still get "access denied" as root user in MySQL.

> mysqld_safe --init-file=~/mysql-init &

Ack! That is very dangerous. It has the same effect as:
cp /dev/null mysqld_safe

Assuming that you did not clobber your program, you need to figure out where mysqld_safe actually is. Then use the absolute path:
/this/that/the_other/mysqld_safe

Note that even if you have a directory called /this/that/the_other/ I am not implying that your mysqld_safe resides there. You need to replace /this/that/the_other/ with the correct directory.

Dear all,

I have a bit of knowledge in DOS, and can ftp and telnet from the DOS promt to my university account. Now what I want to know is:

  1. By doing this, am I already using UNIX

  2. Does anyone know where I can get some sort of download on Unix. e.g the OS and material just to help more on UNIX.

thanks

  1. yes, if your university account is on a unix box.
  2. Try cygwin - Free. It runs linux under windows - google for download cygwin. It comes with man pages and a tool called info for more extended help