Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


mysqladmin syntax error

Posted on 2004-10-22
Medium Priority
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? Mysql.com documentation for mysqladmin is not helpful because they don't give actual examples for setting the initial password.
Question by:SweatCoder
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

Duane Lawrence earned 1200 total points
ID: 12386291

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


Expert Comment

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

ID: 12479820
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.

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

604 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