Change mysql user password using command line

前端 未结 9 1449
小鲜肉
小鲜肉 2021-01-31 06:49

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 S         


        
9条回答
  •  爱一瞬间的悲伤
    2021-01-31 07:16

    Before MySQL 5.7.6 this works from the command line:

    mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$w0rdf1sh');"
    

    I don't have a mysql install to test on but I think in your case it would be

    mysql -e "UPDATE mysql.user SET Password=PASSWORD('$w0rdf1sh') WHERE User='tate256';"
    

提交回复
热议问题