9 Replies - 2821 Views - Last Post: 02 March 2013 - 08:27 PM

#1 ak4744710   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 136
  • Joined: 30-January 13

syntax error when trying to change pw in mysql

Posted 02 March 2013 - 05:44 PM

I am getting the following error when I try to change the password in mysql
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 'user='root'' at line 1
I am using mysql for the first time ever and I am using command prompt I do understand there is a syntax error and I know what a syntax error means but I am unable to find my error. Our professor uploaded a how to video to show us how to use mysql and how to create our new password and what not but I keep getting this error I am copying everything she showed us character for character and do not understand the issue. I can tell you this although I am not sure if it is relivant or not, it says I am using server version 5.5.24-log MySql Community Server. In her video I see she is using
5.0.27-community-nt. The way we are being told to do this is to first go to MySQL Console then when were in becuase we do not have a pw yet we are supposed to hit enter. After that we are told to type in use mysql;, then we are supposed to type UPDATE user SET password=PASSWORD<'password here'> where USER='root';
After I type that line I get the error any ideas how to fix this or if I am doing something wrong would be greatly appreciated I have been trying for hours thanks

Is This A Good Question/Topic? 0
  • +

Replies To: syntax error when trying to change pw in mysql

#2 andrewsw   User is offline

  • blow up my boots
  • member icon

Reputation: 6549
  • View blog
  • Posts: 26,553
  • Joined: 12-December 12

Re: syntax error when trying to change pw in mysql

Posted 02 March 2013 - 05:49 PM

The significant omission from your description is the actual code that creates the error. Post your code (the line that you are typing) that creates the SQL statement.

Quote

I have been trying for hours thanks

..trying what? Guessing?

This post has been edited by andrewsw: 02 March 2013 - 05:54 PM

Was This Post Helpful? 0
  • +
  • -

#3 ak4744710   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 136
  • Joined: 30-January 13

Re: syntax error when trying to change pw in mysql

Posted 02 March 2013 - 05:57 PM

View Postandrewsw, on 02 March 2013 - 07:49 PM, said:

The significant omission from your description is the actual code that creates the error. Post your code (the line that you are typing) that creates the SQL statement.

Quote

I have been trying for hours thanks

..trying what? Guessing?

If I understood your post correctly this is the code
 UPDATE user SET password=PASSWORD<'password here'> where USER='root';

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • blow up my boots
  • member icon

Reputation: 6549
  • View blog
  • Posts: 26,553
  • Joined: 12-December 12

Re: syntax error when trying to change pw in mysql

Posted 02 March 2013 - 06:02 PM

UPDATE user SET password='type your password here' where USER='root';

It is unfortunate that the table is named the same as the field 'user'.

Added: Well this may not be correct as I don't know the syntax for your community server, only for standard SQL statements.

This post has been edited by andrewsw: 02 March 2013 - 06:04 PM

Was This Post Helpful? 1
  • +
  • -

#5 ak4744710   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 136
  • Joined: 30-January 13

Re: syntax error when trying to change pw in mysql

Posted 02 March 2013 - 06:05 PM

I was trying to figure out what my problem was by typing it a couple differant times to see if I had a typo and I was searching online through a search engine. It does not make any sense to me becuase I copied everything she showed us with no luck. in the video it seems to work fine and it says
Query OK, 1 row affected <0.00 sec> 
Rows matched: 1 Changed: 1 Warnings: 0
mysql>


View Postandrewsw, on 02 March 2013 - 08:02 PM, said:

UPDATE user SET password='type your password here' where USER='root';

It is unfortunate that the table is named the same as the field 'user'.

Sorry about my last post I noticed you replied with what I think was my problem while I was typing out my second message. I am assuming you are telling me to remove the <> in my code I will try right now and post if this works thank you.
Was This Post Helpful? 0
  • +
  • -

#6 ak4744710   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 136
  • Joined: 30-January 13

Re: syntax error when trying to change pw in mysql

Posted 02 March 2013 - 06:12 PM

thank you very much seems to be working I do not know where she got the extra word PASSWORD from or the <> or why it worked lol but I am glad you were able to help me.
Was This Post Helpful? 0
  • +
  • -

#7 ak4744710   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 136
  • Joined: 30-January 13

Re: syntax error when trying to change pw in mysql

Posted 02 March 2013 - 07:21 PM

seems to not be working as well as I thought. It did go through but when I went to the next step where we are supposed to type Flush Privileges it does not work. I typed that and when I came back in I was not able to use my pw. I could just hit enter to get in but when I did that then it would not let me change to use mysql anymore. I had to reinstall wamp server and now I'm back where I started any ideas?
Was This Post Helpful? 0
  • +
  • -

#8 andrewsw   User is offline

  • blow up my boots
  • member icon

Reputation: 6549
  • View blog
  • Posts: 26,553
  • Joined: 12-December 12

Re: syntax error when trying to change pw in mysql

Posted 02 March 2013 - 07:42 PM

I cannot give advice other than to watch the video again and follow the instructions closely. As, it seems, you are unsure of what you are doing it may, unfortunately, take you a few attempts.

If you are using the MySql console then this page states that the command to change the root password (for WAMP) is:

mysql> SET PASSWORD FOR ‘root’@'localhost’=PASSWORD(’new_password’); 

but you seem to have a different set-up (a community server). Good luck!
Was This Post Helpful? 0
  • +
  • -

#9 ak4744710   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 136
  • Joined: 30-January 13

Re: syntax error when trying to change pw in mysql

Posted 02 March 2013 - 07:51 PM

Thank you I will look into this. I do not know much about this, we have been using wamp server for our php codes but now we are just starting to use the my sql and its all new to me lol. Thanks for your time and advice.
Was This Post Helpful? 0
  • +
  • -

#10 ak4744710   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 136
  • Joined: 30-January 13

Re: syntax error when trying to change pw in mysql

Posted 02 March 2013 - 08:27 PM

I figured out the answer finally I do not know what was going on in the vid but just in case someone else is strugling with this and comes across this forum what it is is instead of using <> use () as shown below
use mysql;
UPDATE user SET password=PASSWORD(‘welcome’)WHERE user=‘root’;
FLUSH PRIVILEGES; 

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1