mysqladmin syntax error

Posted on 2004-10-22
Last Modified: 2012-06-21
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.
Question by:SweatCoder
    LVL 6

    Accepted Solution


    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

    LVL 6

    Expert Comment

    by:Duane Lawrence
    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.

    LVL 11

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: Foundations of Front-End Development

    Jump-start a lucrative career in front-end web development, with zero previous coding experience required. This course covers the basic programming concepts and languages required for creating engaging websites from scratch.

    Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now