I'm trying to update the password for a database user using the command line, and it's not working for me. This is the code I'm using:
mysql> UPDATE user SET password=PASSWORD($w0rdf1sh) WHERE user='tate256';
Could someone tell me what's wrong with this code.
In windows 10, just exit out of current login and run this on command line
-->
mysqladmin -u root password “newpassword”
where instead of root could be any user.
As of MySQL 5.7.6, use
ALTER USER
Example:
Because:
SET PASSWORD ... = PASSWORD('auth_string')
syntax is deprecated as of MySQL 5.7.6 and will be removed in a future MySQL release.SET PASSWORD ... = 'auth_string'
syntax is not deprecated, butALTER USER
is now the preferred statement for assigning passwords.In your code, try enclosing password inside single quote. Alternatively, as per the documentation of mysql, following should work -
The last line is important or else your password change won't take effect unfortunately.
EDIT:
I ran a test in my local and it worked -
Mine is version 5. You can use following command to determine your version -
Your login root should be
/usr/local/directadmin/conf/mysql.conf
. Then try followingHost is your mysql host.
Note: u should login as root user
this is the updated answer for WAMP v3.0.6