Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

correct syntax for setting password using mysql 5.5.8 command line

I've just downloaded and installed WAMPserver 2.1 and I want to set a password for the MySQL 5.5.8 database. I'm doing a tutorial at lynda.com and the tutor (Kevin Skoglund) instructions to type:

mysql> use mysql
Database changed

mysql> UPDATE user
    -> SET Password = PASSWORD('paSSword')
    -> WHERE user = 'root';

When I hit enter, I get this error about the WHERE statement:

ERROR 1064 (42000): 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 2

Does anyone know the correct syntax for the WHERE statement? His lessons were done in 2007, so I guess the syntax has changed because it worked for him in the video. This line was returned for him:

Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1  Warnings: 0
mysql>

Thanks

like image 343
Chris22 Avatar asked Sep 20 '11 16:09

Chris22


People also ask

How can change MySQL root password using CMD?

Create a text file containing the password-assignment statement on a single line. Replace the password with the password that you want to use. ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; Save the file.


1 Answers

This works on my test server:

mysql> UPDATE user SET password=PASSWORD('newpassword') WHERE user ='root';
mysql> Query OK

You are trying to set Password instead of password (lowercased)

Shai.

like image 99
Shai Mishali Avatar answered Oct 17 '22 08:10

Shai Mishali