mysqladmin syntax error

On a fresh install of MySQL 4.1.3B, I'm running this line in the windows command shell before a password has been set:

c:\mysql\bin\mysqladmin -u root password mypassword

. . .and I get the error: "the syntax of the command is incorrect."

. . .and yet the script actually works and sets the password correctly. So why am I getting this error and how can I run the line differently so that the error is not thrown? documentation for mysqladmin is not helpful because they don't give actual examples for setting the initial password.
LVL 11
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Duane LawrenceCommented:

I run a PHP MySQL user group and give lectures on how to get MySQL running, the biggest trick is doing the grant on the user in the my.ini file.

# I downloaded and installed MySQL just fine, Using it is proving
# to be difficult. It should be noted that the "HELP" is in the
# manuals and can be found on the following path:
# file:///C:/mysql/Docs/manual_toc.html

#2. Run c:\mysql\bin\winmysqladmin.exe, it will set up a user
# and a password.
# These are entered into the my.ini file by winmysqladmin.exe.
# You can look them up if you forget. For this purpose,
# the user name is John and the password is foo.

#using the mysql.exe shell from a command line.
#The second mysql specifies the database your connecting to.
mysql mysql -h localhost -u root -p
#IMPORTANT: Before I did the above command, when I did a
#'show databases;' the only one I got was the test database.

#4. now grant all to user on the PC your on.
#where testpc is the name of the computer that MySQL is on
#and where xxx is the password.
grant all privileges on *.* to john@testpc identified by 'foo' with grant option;

#5. finally create the database.
create database foo;

#Add "c:\mysql\bin" to the "path" in system variables.
# That is assuming you installed MySQL to the "c:\mysql"
# How to get there: Open the control panel in Windows,
# open the system, goto the advanced tab, click on the
# "enviornment variables" button, edit the path and add
# the above.

This can be found on

Or join the group


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Duane LawrenceCommented:
Its a good answer.  It took me weeks to work it out.  The largest problem being the lack of instructions on granting privelges.  This is a complete instruction on how to install MySQL and get it running to where you can actually insert data.

SweatCoderAuthor Commented:
ok, i'll buy it. a bit too general for me because it didn't specifically answer my question, but still some good info there. case closed.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.