9Algorithm
9Algorithm

Reputation: 1257

MySQL: Trying set a password for root, Error in SQL Syntax

This piece of code is from the Learning MySQL and MariaDB book:

mysql -u root -p -e "SET PASSWORD FOR 'root'@'127.0.0.1' PASSWORD('new_pwd');"

And I'm getting this error:

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for th
e right syntax to use near 'PASSWORD('new_pwd')' at line 1

Is this book correct? Isn't this syntax old? What's the problem?

Upvotes: 1

Views: 76

Answers (1)

Tudor Constantin
Tudor Constantin

Reputation: 26861

try with:

mysql -u root -p -e "SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('new_pwd');"

Upvotes: 2

Related Questions